From ce476e0f6d704da277634c846f054d300192cf70 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Thu, 21 Dec 2023 09:58:46 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20defect=20?= =?UTF-8?q?=E0=B9=80=E0=B8=A3=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=87=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B9=80=E0=B8=A3=E0=B8=B5=E0=B8=A2=E0=B8=87?= =?UTF-8?q?=E0=B8=A5=E0=B8=B3=E0=B8=94=E0=B8=B1=E0=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TimeAttendants/AdditionalCheckRequestRepository.cs | 2 ++ .../TimeAttendants/ProcessUserTimeStampRepository.cs | 2 +- BMA.EHR.Leave.Service/Controllers/LeaveController.cs | 5 +++++ BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs | 8 ++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs index 2cbd1d34..e51ec08f 100644 --- a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs +++ b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs @@ -64,6 +64,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants var data = await _dbContext.Set().AsQueryable() .Where(x => x.KeycloakUserId == keycloakId) .Where(x => (x.CheckDate.Year == year && x.CheckDate.Month == month)) + .OrderByDescending(x => x.CheckDate.Date) // add sort for fix defect .ToListAsync(); return data; @@ -80,6 +81,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants { var data = await _dbContext.Set().AsQueryable() .Where(x => (x.CheckDate.Year == year && x.CheckDate.Month == month)) + .OrderByDescending(x => x.CreatedAt.Date) .ToListAsync(); return data; diff --git a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/ProcessUserTimeStampRepository.cs b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/ProcessUserTimeStampRepository.cs index 9d0119c5..eb8dda94 100644 --- a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/ProcessUserTimeStampRepository.cs +++ b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/ProcessUserTimeStampRepository.cs @@ -137,7 +137,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants var data = await _dbContext.Set() .Where(u => u.KeycloakUserId == keycloakId) .Where(u => u.CheckIn.Year == year) - .OrderBy(u => u.CheckIn) + .OrderByDescending(u => u.CheckIn.Date) .Skip((page - 1) * pageSize) .Take(pageSize) .ToListAsync(); diff --git a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs index 7e55fd9f..36024048 100644 --- a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs +++ b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs @@ -556,6 +556,8 @@ namespace BMA.EHR.Leave.Service.Controllers DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}") ? "LATE" : "NORMAL", + CheckInIsLocation = d.IsLocationCheckIn, + CheckInLocationName = d.CheckInLocationName, CheckOutDate = d.CheckOut == null ? null : d.CheckOut.Value.Date, CheckOutTime = d.CheckOut == null ? "" : d.CheckOut.Value.ToString("HH:mm:ss"), CheckOutLocation = d.CheckOutPOI ?? "", @@ -568,6 +570,9 @@ namespace BMA.EHR.Leave.Service.Controllers "ABSENT" : "NORMAL", + CheckOutIsLocation = d.IsLocationCheckOut, + CheckOutLocationName = d.CheckOutLocationName, + IsEdit = _processUserTimeStampRepository.IsEditRequest(userId, d.CheckIn.Date) //IsEdit = (d.EditStatus != null && d.EditStatus != "") diff --git a/BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs b/BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs index aeef002f..c5fe905c 100644 --- a/BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs +++ b/BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs @@ -12,6 +12,10 @@ public string? CheckInStatus { get; set; } = string.Empty; + public bool CheckInIsLocation { get; set; } = false; + + public string? CheckInLocationName { get; set; } = string.Empty; + public DateTime? CheckOutDate { get; set; } = DateTime.MinValue; public string? CheckOutTime { get; set; } = "00:00"; @@ -20,6 +24,10 @@ public string? CheckOutStatus { get; set; } = string.Empty; + public bool CheckOutIsLocation { get; set; } = false; + + public string? CheckOutLocationName { get; set; } = string.Empty; + //public string EditStatus { get; set; } = string.Empty; //public string EditReason { get; set; } = string.Empty;