fix sort order condition
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m15s

This commit is contained in:
Suphonchai Phoonsawat 2026-01-16 16:09:23 +07:00
parent 83a915f92c
commit 510f1cd78a

View file

@ -2251,7 +2251,7 @@ namespace BMA.EHR.Leave.Service.Controllers
}
//employees = employees.OrderBy(x => x.checkInDate).ThenBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
employees = employees
.OrderBy(x => x.checkInTime.Trim() == "" ? 1 : 0) // เรียงตามวันที่ลงเวลา
.OrderBy(x => x.checkInTime.Trim() != "" ? 0 : 1) // เรียงตามวันที่ลงเวลา
.ThenBy(x => x.remark.Trim() == "" ? 0 : 1) // ข้อมูลที่ไม่มี remark ให้ขึ้นก่อน
.ThenBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue)
.ThenBy(x => x.remark) // จากนั้นจัดเรียงตาม remark