From 69a4ad72862812ca642e1c0429cec4e9fb17d99c Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 2 Apr 2025 13:22:32 +0530 Subject: [PATCH] Fixed bug regrading passing incorrect tenantId and sending list of active and inactive employees rather than list of active or inc=active employees --- .../Controllers/AttendanceController.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Marco.Pms.Services/Controllers/AttendanceController.cs b/Marco.Pms.Services/Controllers/AttendanceController.cs index 3103b9b..2fb7ab0 100644 --- a/Marco.Pms.Services/Controllers/AttendanceController.cs +++ b/Marco.Pms.Services/Controllers/AttendanceController.cs @@ -40,15 +40,15 @@ namespace MarcoBMS.Services.Controllers } private int GetUserId() { - var tenant = User.FindFirst("Id")?.Value; - return (tenant != null ? Convert.ToInt32(tenant) : 1); + var user = _userHelper.GetCurrentUserAsync(); + return user.Id; } [HttpGet("log/attendance/{attendanceid}")] public async Task GetAttendanceLogById(int attendanceid) { - int TenantId = GetUserId(); + int TenantId = GetTenantId(); List lstAttendance = await _context.AttendanceLogs.Where(c => c.AttendanceId == attendanceid && c.TenantId == TenantId).ToListAsync(); @@ -59,7 +59,7 @@ namespace MarcoBMS.Services.Controllers public async Task GetAttendanceLogByEmployeeId(int employeeid, [FromQuery] string? date = null) { - int TenantId = GetUserId(); + int TenantId = GetTenantId(); DateOnly forDate = new DateOnly(); if (date != null && DateOnly.TryParse(date, out forDate) == false) @@ -84,7 +84,7 @@ namespace MarcoBMS.Services.Controllers public async Task EmployeeAttendanceByDateRange([FromQuery] int projectId, [FromQuery] string? dateFrom = null, [FromQuery] string? dateTo = null) { - int TenantId = GetUserId(); + int TenantId = GetTenantId(); DateTime fromDate = new DateTime(); DateTime toDate = new DateTime(); @@ -149,9 +149,9 @@ namespace MarcoBMS.Services.Controllers /// [HttpGet("project/team")] - public async Task EmployeeAttendanceByProject([FromQuery] int projectId, [FromQuery] string? date = null) + public async Task EmployeeAttendanceByProject([FromQuery] int projectId, [FromQuery] bool IncludeInActive, [FromQuery] string? date = null) { - int TenantId = GetUserId(); + int TenantId = GetTenantId(); DateTime forDate = new DateTime(); if (date != null && DateTime.TryParse(date, out forDate) == false) @@ -172,7 +172,7 @@ namespace MarcoBMS.Services.Controllers List lstAttendance = await _context.Attendes.Where(c => c.ProjectID == projectId && c.AttendanceDate.Date == forDate && c.TenantId == TenantId).ToListAsync(); - List projectteam = await _projectsHelper.GetTeamByProject(TenantId, projectId, true); + List projectteam = await _projectsHelper.GetTeamByProject(TenantId, projectId, IncludeInActive); foreach (ProjectAllocation teamMember in projectteam) {