fix contains no element error for empty skills

This commit is contained in:
2026-01-10 10:34:20 +03:30
parent b6fde4903a
commit b741ab9ed2

View File

@@ -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,