แก้ defect เรื่องการเรียงลำดับ

This commit is contained in:
Suphonchai Phoonsawat 2023-12-21 09:58:46 +07:00
parent e21d19ea23
commit ce476e0f6d
4 changed files with 16 additions and 1 deletions

View file

@ -64,6 +64,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
var data = await _dbContext.Set<AdditionalCheckRequest>().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<AdditionalCheckRequest>().AsQueryable()
.Where(x => (x.CheckDate.Year == year && x.CheckDate.Month == month))
.OrderByDescending(x => x.CreatedAt.Date)
.ToListAsync();
return data;

View file

@ -137,7 +137,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
var data = await _dbContext.Set<ProcessUserTimeStamp>()
.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();

View file

@ -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 != "")

View file

@ -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;