diff --git a/PARR.TemplateDistributor/TemplateDistributor.cs b/PARR.TemplateDistributor/TemplateDistributor.cs index 2d8c935b..802b2c08 100644 --- a/PARR.TemplateDistributor/TemplateDistributor.cs +++ b/PARR.TemplateDistributor/TemplateDistributor.cs @@ -160,7 +160,7 @@ namespace PARR.TemplateDistributor distrPlan[workDay.Key] -= templatesCountForCurDay; } - return templateToDistrib; + return templates; @@ -312,7 +312,7 @@ namespace PARR.TemplateDistributor var templateDistributed = 0; - if (templateCount > workDays.Count) + if (templateCount >= workDays.Count) { var mainPartTemplateCountToDistribute = templateCount / workDays.Count; foreach (var item in d) @@ -323,6 +323,7 @@ namespace PARR.TemplateDistributor } } + var templatesPerWorkDay = (double)workDays.Count / (templateCount % workDays.Count); var currentStep = (double)Math.Floor(templatesPerWorkDay);//??????? точно double? var balance = (double)templatesPerWorkDay - Math.Floor(currentStep); @@ -336,10 +337,11 @@ namespace PARR.TemplateDistributor templateDistributed++; currentIndex += (int)Math.Floor(currentStep); - currentStep = templatesPerWorkDay + balance; - balance = currentStep - templatesPerWorkDay; - } + } + + currentStep = templatesPerWorkDay + balance; + balance = templatesPerWorkDay - currentStep; } return d;