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 : IBaseCommandHandler 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..6a0a7cda 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 @@ -45,13 +45,15 @@ public class ProjectDeployBoardListQueryHandler:IBaseQueryHandlerx.Activities) .Include(x=>x.Task) .ThenInclude(x => x.Phase) .ThenInclude(x => x.Project) .AsNoTracking() .Where(x => 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 +62,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);