From f6f1f775a84000d75c544818829424374e2757a9 Mon Sep 17 00:00:00 2001 From: Mikhail Trubnikov Date: Mon, 16 Sep 2024 12:03:08 +1000 Subject: [PATCH] =?UTF-8?q?feat(api):=20=D1=81=D1=80=D0=B5=D0=B4=D0=BD?= =?UTF-8?q?=D0=B5=D0=B5=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20workload=20=D1=81=D1=87=D0=B8=D1=82?= =?UTF-8?q?=D0=B0=D0=B5=D0=BC=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=B4=D0=BD=D0=B5=D0=B9=20=D1=83=20=D0=BA?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D1=85=20=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=20=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=200.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Statistics/StatWorkLoadDataBaseResponse.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/PARR.API/Contracts/V1/Responses/Statistics/StatWorkLoadDataBaseResponse.cs b/PARR.API/Contracts/V1/Responses/Statistics/StatWorkLoadDataBaseResponse.cs index 3d7c4a99..7644388f 100644 --- a/PARR.API/Contracts/V1/Responses/Statistics/StatWorkLoadDataBaseResponse.cs +++ b/PARR.API/Contracts/V1/Responses/Statistics/StatWorkLoadDataBaseResponse.cs @@ -6,7 +6,17 @@ public int WorksCount => WorkLoad?.Sum(t => t.TemplateCount) ?? 0; - public double AverageWorksCount => Math.Round((double)WorksCount / WorkLoad.Count(), 2); + public double AverageWorksCount + { + get + { + int divider = WorkLoad.Where(t => t.TemplateCount > 0).Count(); + if (divider > 0) + return Math.Round((double)WorksCount / divider, 2); + + return 0; + } + }//=> Math.Round((double)WorksCount / WorkLoad.Where(t => t.TemplateCount > 0).Count(), 2); } public class StatWorkLoadDataResponse