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.
Files changed (2) hide show
  1. package/clock.js +17 -11
  2. 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
- // Determine status
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 (day.ReClockIn) {
500
- notes = `ReClock: ${day.ReClockIn.Status === 0 ? 'Pending' : day.ReClockIn.Status === 1 ? 'Approved' : 'Rejected'}`;
504
+ if (isPast) {
505
+ notes = 'ReClock needed';
501
506
  }
502
507
  } else if (!day.ClockOut) {
503
508
  status = 'No Out';
504
- if (day.ReClockOut) {
505
- notes = `ReClockOut: ${day.ReClockOut.Status === 0 ? 'Pending' : 'Done'}`;
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-clock-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CLI tool for automatic clock in/out with HRMS integration",
5
5
  "main": "clock.js",
6
6
  "bin": {