fix(templateDistributor): исправлено зацикливание Worker при распределении по периоду равно количества шаблонов и рабочий к дней
This commit is contained in:
@@ -160,7 +160,7 @@ namespace PARR.TemplateDistributor
|
|||||||
distrPlan[workDay.Key] -= templatesCountForCurDay;
|
distrPlan[workDay.Key] -= templatesCountForCurDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
return templateToDistrib;
|
return templates;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ namespace PARR.TemplateDistributor
|
|||||||
|
|
||||||
var templateDistributed = 0;
|
var templateDistributed = 0;
|
||||||
|
|
||||||
if (templateCount > workDays.Count)
|
if (templateCount >= workDays.Count)
|
||||||
{
|
{
|
||||||
var mainPartTemplateCountToDistribute = templateCount / workDays.Count;
|
var mainPartTemplateCountToDistribute = templateCount / workDays.Count;
|
||||||
foreach (var item in d)
|
foreach (var item in d)
|
||||||
@@ -323,6 +323,7 @@ namespace PARR.TemplateDistributor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var templatesPerWorkDay = (double)workDays.Count / (templateCount % workDays.Count);
|
var templatesPerWorkDay = (double)workDays.Count / (templateCount % workDays.Count);
|
||||||
var currentStep = (double)Math.Floor(templatesPerWorkDay);//??????? точно double?
|
var currentStep = (double)Math.Floor(templatesPerWorkDay);//??????? точно double?
|
||||||
var balance = (double)templatesPerWorkDay - Math.Floor(currentStep);
|
var balance = (double)templatesPerWorkDay - Math.Floor(currentStep);
|
||||||
@@ -336,10 +337,11 @@ namespace PARR.TemplateDistributor
|
|||||||
templateDistributed++;
|
templateDistributed++;
|
||||||
currentIndex += (int)Math.Floor(currentStep);
|
currentIndex += (int)Math.Floor(currentStep);
|
||||||
|
|
||||||
currentStep = templatesPerWorkDay + balance;
|
|
||||||
balance = currentStep - templatesPerWorkDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
currentStep = templatesPerWorkDay + balance;
|
||||||
|
balance = templatesPerWorkDay - currentStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
|
|||||||
Reference in New Issue
Block a user