diff --git a/Marco.Pms.Services/Controllers/DashboardController.cs b/Marco.Pms.Services/Controllers/DashboardController.cs index d6b7fc8..97b3db6 100644 --- a/Marco.Pms.Services/Controllers/DashboardController.cs +++ b/Marco.Pms.Services/Controllers/DashboardController.cs @@ -17,13 +17,13 @@ namespace Marco.Pms.Services.Controllers { private readonly ApplicationDbContext _context; private readonly UserHelper _userHelper; - public DashboardController(ApplicationDbContext context,UserHelper userHelper) + public DashboardController(ApplicationDbContext context, UserHelper userHelper) { _context = context; _userHelper = userHelper; } [HttpGet("progression")] - public async Task GetGraph([FromQuery] double days,[FromQuery] int projectId, [FromQuery] string? FromDate) + public async Task GetGraph([FromQuery] double days, [FromQuery] int projectId, [FromQuery] string? FromDate) { var tenantId = _userHelper.GetTenantId(); DateTime fromDate = new DateTime(); @@ -34,7 +34,7 @@ namespace Marco.Pms.Services.Controllers return BadRequest(ApiResponse.ErrorResponse("Invalid starting date.", "Invalid starting date.", 400)); } - if(projectId == null) { projectId = 0; } + if (projectId == null) { projectId = 0; } if (FromDate == null) fromDate = DateTime.UtcNow.Date; @@ -44,8 +44,8 @@ namespace Marco.Pms.Services.Controllers toDate = fromDate.AddDays(negativeDays); if (projectId == 0) { - List tasks = await _context.TaskAllocations.Where(t => t.AssignmentDate <= fromDate && t.AssignmentDate >= toDate && t.TenantId == tenantId).ToListAsync(); - + List tasks = await _context.TaskAllocations.Where(t => t.AssignmentDate.Date <= fromDate.Date && t.AssignmentDate.Date >= toDate.Date && t.TenantId == tenantId).ToListAsync(); + double flagDays = 0; while (negativeDays < flagDays) { @@ -85,8 +85,8 @@ namespace Marco.Pms.Services.Controllers List workItems = await _context.WorkItems.Where(i => idList.Contains(i.WorkAreaId) && i.TenantId == tenantId).ToListAsync(); idList = workItems.Select(i => i.Id).ToList(); - List tasks = await _context.TaskAllocations.Where(t => idList.Contains(t.WorkItemId) && t.AssignmentDate <= fromDate && t.AssignmentDate >= toDate && t.TenantId == tenantId).ToListAsync(); - if(project != null) + List tasks = await _context.TaskAllocations.Where(t => idList.Contains(t.WorkItemId) && t.AssignmentDate.Date <= fromDate.Date && t.AssignmentDate.Date >= toDate.Date && t.TenantId == tenantId).ToListAsync(); + if (project != null) { double flagDays = 0; while (negativeDays < flagDays) @@ -142,7 +142,7 @@ namespace Marco.Pms.Services.Controllers var Employees = await _context.Employees.Where(e => e.TenantId == tenantId && e.IsActive == true).Select(e => e.Id).ToListAsync(); - var checkedInEmployee = await _context.Attendes.Where(e => e.Date.Date == date ).ToListAsync(); + var checkedInEmployee = await _context.Attendes.Where(e => e.Date.Date == date).ToListAsync(); TeamDashboardVM teamDashboardVM = new TeamDashboardVM { @@ -157,7 +157,7 @@ namespace Marco.Pms.Services.Controllers { var tenantId = _userHelper.GetTenantId(); - var Tasks = await _context.WorkItems.Where(t => t.TenantId == tenantId).Select(t => new { PlannedWork = t.PlannedWork, CompletedWork = t.CompletedWork}).ToListAsync(); + var Tasks = await _context.WorkItems.Where(t => t.TenantId == tenantId).Select(t => new { PlannedWork = t.PlannedWork, CompletedWork = t.CompletedWork }).ToListAsync(); TasksDashboardVM tasksDashboardVM = new TasksDashboardVM { TotalTasks = 0,