refactor: Enhance employee sorting by action priority and latest entry time
This commit is contained in:
parent
47da83813d
commit
41ab77d136
@ -178,11 +178,19 @@ class _AttendanceLogsTabState extends State<AttendanceLogsTab> {
|
||||
child: MyText.bodyMedium(date, fontWeight: 700),
|
||||
),
|
||||
|
||||
// Sort employees inside this date by action priority
|
||||
// Sort employees inside this date by action priority first, then latest entry
|
||||
for (final emp in (groupedLogs[date]!
|
||||
..sort(
|
||||
(a, b) => _getActionPriority(a)
|
||||
.compareTo(_getActionPriority(b)),
|
||||
(a, b) {
|
||||
final priorityCompare = _getActionPriority(a)
|
||||
.compareTo(_getActionPriority(b));
|
||||
if (priorityCompare != 0) return priorityCompare;
|
||||
|
||||
final aTime = a.checkOut ?? a.checkIn ?? DateTime(0);
|
||||
final bTime = b.checkOut ?? b.checkIn ?? DateTime(0);
|
||||
return bTime.compareTo(
|
||||
aTime);
|
||||
},
|
||||
))) ...[
|
||||
MyContainer(
|
||||
paddingAll: 8,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user