From b741ab9ed2ea7cb8e1f2f0094853bafa0fc257d9 Mon Sep 17 00:00:00 2001 From: mahan Date: Sat, 10 Jan 2026 10:34:20 +0330 Subject: [PATCH] fix contains no element error for empty skills --- .../ProjectDeployBoardDetailsQueryHandler.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectDeployBoardDetail/ProjectDeployBoardDetailsQueryHandler.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectDeployBoardDetail/ProjectDeployBoardDetailsQueryHandler.cs index ddff2247..9d93332d 100644 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectDeployBoardDetail/ProjectDeployBoardDetailsQueryHandler.cs +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectDeployBoardDetail/ProjectDeployBoardDetailsQueryHandler.cs @@ -73,6 +73,7 @@ public class var doneTime = t.Sections.Aggregate(TimeSpan.Zero, (sum, next) => sum.Add(next.GetTotalTimeSpent())); + var skills = t.Sections .Select(s => { @@ -88,7 +89,14 @@ public class skillName, timePercentage); }).ToList(); - var taskPercentage = (int)Math.Round(skills.Average(x => x.TimePercentage)); + + int taskPercentage = 0; + + if (!skills.Any()) + { + taskPercentage = 0; + } + taskPercentage = (int)Math.Round(skills.Average(x => x.TimePercentage)); return new ProjectDeployBoardDetailTaskItem( t.Name,