From 45615684ed0854b5cf697c80dfcc85178da5855d Mon Sep 17 00:00:00 2001 From: mahan Date: Tue, 30 Dec 2025 15:55:57 +0330 Subject: [PATCH 1/2] add: enhance skill calculation in ProjectDeployBoardDetailsQueryHandler and refine query conditions in ProjectDeployBoardListQueryHandler --- .../ProjectDeployBoardDetailsQueryHandler.cs | 24 ++++++++++++++----- .../ProjectDeployBoardListQueryHandler.cs | 11 +++++---- 2 files changed, 24 insertions(+), 11 deletions(-) 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 3e3657d9..33a1caa6 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 @@ -72,12 +72,24 @@ public class var doneTime = t.Sections.Aggregate(TimeSpan.Zero, (sum, next) => sum.Add(next.GetTotalTimeSpent())); var skills = t.Sections - .Select(s => new ProjectDeployBoardDetailItemSkill( - usersDict.GetValueOrDefault(s.OriginalAssignedUserId, "کاربر ناشناس"), - s.Skill?.Name ?? "بدون مهارت", - totalTime.TotalSeconds > 0 - ? (int)((doneTime.TotalSeconds / totalTime.TotalSeconds) * 100) - : 0)).ToList(); + .Select(s => + { + var originalUserFullName = usersDict.GetValueOrDefault(s.OriginalAssignedUserId, + "کاربر ناشناس"); + + var skillName = s.Skill?.Name ?? "بدون مهارت"; + + var totalTimeSpent = s.GetTotalTimeSpent(); + + var timePercentage = s.FinalEstimatedHours.Ticks > 0 + ? (int)((totalTimeSpent.Ticks / (double)s.FinalEstimatedHours.Ticks) * 100) + : 0; + + return new ProjectDeployBoardDetailItemSkill( + originalUserFullName, + skillName, + timePercentage); + }).ToList(); return new ProjectDeployBoardDetailTaskItem( t.Name, diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectDeployBoardList/ProjectDeployBoardListQueryHandler.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectDeployBoardList/ProjectDeployBoardListQueryHandler.cs index d0b7e6e5..380e08ea 100644 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectDeployBoardList/ProjectDeployBoardListQueryHandler.cs +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectDeployBoardList/ProjectDeployBoardListQueryHandler.cs @@ -51,7 +51,8 @@ public class ProjectDeployBoardListQueryHandler:IBaseQueryHandler x.Status == TaskSectionStatus.Completed || x.Status == TaskSectionStatus.PendingForCompletion - || x.Task.Phase.DeployStatus != ProjectDeployStatus.NotCompleted) + || (x.Task.Phase.DeployStatus != ProjectDeployStatus.NotCompleted + && x.InitialEstimatedHours>TimeSpan.Zero)) .GroupBy(x=>x.Task.PhaseId).ToListAsync(cancellationToken: cancellationToken); var list = query.Select(g => new ProjectDeployBoardListItem @@ -60,10 +61,10 @@ public class ProjectDeployBoardListQueryHandler:IBaseQueryHandler x.TaskId).Distinct().Count(), - DoneTasks = g.Where(x => x.Status == TaskSectionStatus.Completed).Select(x => x.TaskId).Distinct().Count(), - TotalTimeSpan = TimeSpan.FromHours(g.Sum(x => x.InitialEstimatedHours.TotalHours)), - DoneTimeSpan = TimeSpan.FromHours(g.Where(x => x.Status == TaskSectionStatus.Completed) - .Sum(x => x.InitialEstimatedHours.TotalHours)), + DoneTasks = g.Where(x => x.Status == TaskSectionStatus.Completed) + .Select(x => x.TaskId).Distinct().Count(), + TotalTimeSpan = TimeSpan.FromTicks(g.Sum(x => x.InitialEstimatedHours.Ticks)), + DoneTimeSpan = TimeSpan.FromTicks(g.Sum(x=>x.GetTotalTimeSpent().Ticks)), DeployStatus = g.First().Task.Phase.DeployStatus }).ToList(); var response = new GetProjectsDeployBoardListResponse(list); From aa37ca4b2898fd7ed8eb047104e5895dc1e0e0a3 Mon Sep 17 00:00:00 2001 From: mahan Date: Tue, 30 Dec 2025 17:19:59 +0330 Subject: [PATCH 2/2] add: enhance deployment status validation in ChangeDeployStatusProject command and include Activities in ProjectDeployBoardList query --- .../ChangeDeployeStatusProjectComand.cs | 5 +++++ .../ProjectDeployBoardListQueryHandler.cs | 1 + 2 files changed, 6 insertions(+) diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/ChangeDeployStatusProject/ChangeDeployeStatusProjectComand.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/ChangeDeployStatusProject/ChangeDeployeStatusProjectComand.cs index 68c336cd..06c75b4a 100644 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/ChangeDeployStatusProject/ChangeDeployeStatusProjectComand.cs +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/ChangeDeployStatusProject/ChangeDeployeStatusProjectComand.cs @@ -31,6 +31,11 @@ public class ChangeDeployStatusProjectCommandHandler : IBaseCommandHandlerx.Activities) .Include(x=>x.Task) .ThenInclude(x => x.Phase) .ThenInclude(x => x.Project)