From 847161ef41d2026ee7bc72795bf1f8a382c58a91 Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Fri, 12 Jul 2024 14:51:01 +1000 Subject: [PATCH] =?UTF-8?q?fix(templateDistributor):=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=BA=D0=BB=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20Worker?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D1=80=D0=B0=D1=81=D0=BF=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=BF=D0=BE=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B8=D0=BE=D0=B4=D1=83=20=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BA=D0=BE=D0=BB=D0=B8=D1=87=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=B0=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B8=20=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B8=D0=B9=20=D0=BA?= =?UTF-8?q?=20=D0=B4=D0=BD=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PARR.TemplateDistributor/TemplateDistributor.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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;