Added the date filter while fetching data from database

This commit is contained in:
ashutosh.nehete 2025-04-11 16:40:57 +05:30
parent b624e9ec62
commit 3fabadc380

View File

@ -44,7 +44,7 @@ namespace Marco.Pms.Services.Controllers
toDate = fromDate.AddDays(negativeDays);
if (projectId == 0)
{
List<TaskAllocation> tasks = await _context.TaskAllocations.Where(t => t.AssignmentDate <= fromDate && t.AssignmentDate >= toDate && t.TenantId == tenantId).ToListAsync();
List<TaskAllocation> 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,7 +85,7 @@ namespace Marco.Pms.Services.Controllers
List<WorkItem> workItems = await _context.WorkItems.Where(i => idList.Contains(i.WorkAreaId) && i.TenantId == tenantId).ToListAsync();
idList = workItems.Select(i => i.Id).ToList();
List<TaskAllocation> tasks = await _context.TaskAllocations.Where(t => idList.Contains(t.WorkItemId) && t.AssignmentDate <= fromDate && t.AssignmentDate >= toDate && t.TenantId == tenantId).ToListAsync();
List<TaskAllocation> 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;