auto-clock-cli 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/clock.js +17 -11
- package/package.json +1 -1
package/clock.js
CHANGED
|
@@ -490,30 +490,36 @@ async function showHistory(days = 14) {
|
|
|
490
490
|
let status = '';
|
|
491
491
|
let notes = '';
|
|
492
492
|
|
|
493
|
-
//
|
|
493
|
+
// Get today's date for comparison
|
|
494
|
+
const today = new Date().toISOString().split('T')[0];
|
|
495
|
+
const isToday = date === today;
|
|
496
|
+
const isPast = date < today;
|
|
497
|
+
|
|
498
|
+
// Determine status based on clock in/out data only
|
|
494
499
|
if (day.LeaveInfo) {
|
|
495
500
|
status = 'Leave';
|
|
496
501
|
notes = 'On Leave';
|
|
497
502
|
} else if (!day.ClockIn && !day.ClockOut) {
|
|
498
503
|
status = 'Missing';
|
|
499
|
-
if (
|
|
500
|
-
notes =
|
|
504
|
+
if (isPast) {
|
|
505
|
+
notes = 'ReClock needed';
|
|
501
506
|
}
|
|
502
507
|
} else if (!day.ClockOut) {
|
|
503
508
|
status = 'No Out';
|
|
504
|
-
if (
|
|
505
|
-
notes =
|
|
509
|
+
if (isPast) {
|
|
510
|
+
notes = 'ReClock out needed';
|
|
511
|
+
} else if (isToday) {
|
|
512
|
+
notes = 'In progress';
|
|
513
|
+
}
|
|
514
|
+
} else if (!day.ClockIn) {
|
|
515
|
+
status = 'No In';
|
|
516
|
+
if (isPast) {
|
|
517
|
+
notes = 'ReClock in needed';
|
|
506
518
|
}
|
|
507
519
|
} else {
|
|
508
520
|
status = 'OK';
|
|
509
521
|
}
|
|
510
522
|
|
|
511
|
-
// Check for reclock info
|
|
512
|
-
if (day.ReClockIn && !notes) {
|
|
513
|
-
const reStatus = day.ReClockIn.Status === 0 ? 'Pending' : day.ReClockIn.Status === 1 ? 'Approved' : 'Rejected';
|
|
514
|
-
notes = `ReClockIn: ${reStatus}`;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
523
|
console.log(`║ ${date} ║ ${clockIn} ║ ${clockOut} ║ ${status.padEnd(8)} ║ ${notes.padEnd(21)} ║`);
|
|
518
524
|
}
|
|
519
525
|
|