Improve workforce scanning, site transfers and timesheet exports. Audit plant imports, duplicate identities, rates and dashboard totals. Repair delivery PO selection, periodic rechecks and receiving guards. Align financial ledgers, supplier periods and mobile layouts. Add the site map preview, shared theme controls and audit evidence. Verify 3,455 application tests, six fuel export tests, TypeScript and an optimized production build. Clean up a leaked test timer and keep local worktrees and generated reports out of ESLint traversal. Changed-file lint passes; repository-wide lint retains 33 existing errors in unchanged files.
5.3 KiB
Workforce reliability and timesheet exports
User requirements: review every workforce view on phone and desktop; preserve one scan audit record per clock action with site and GPS; let workers change sites as they are scanned on different days; prevent duplicate scans; export readable styled Excel timesheets; display rounded duration minutes as H.MM (9.50 = 9 hours 50 minutes).
Implementation choices: retain numeric decimal hours for payroll arithmetic, format only at presentation boundaries; retain current shift/grace/lunch policy. Require an explicit destination site for the new scanner, suggest from GPS but show it for confirmation. Keep prior unmatched days as exceptions rather than inventing historical exit times. Guard writes with the existing per-worker database lock and a transaction so events, hours, and site membership stay consistent. Preserve pre-existing workspace edits.
- Trace all workforce routes, employee scanning, import duplicate rules, and correction flows.
- Add regression coverage for duration labels, site-scoped daily entries, stale submissions, repeated requests, failed database reads, GPS validation, and day resets.
- Implement scan site/GPS capture and atomic scan writes, with a schema migration and daily history UI.
- Add styled XLSX exports with normal/extra/short/sick/off/missing statuses, frozen headings, readable columns and duration totals.
- Apply H.MM formatting throughout workforce and fix mobile overflow or inaccessible actions discovered during review.
- Run workforce/clock/import regression tests, typecheck, lint changed files, and mobile/desktop browser checks. Record deployment requirements and any limits.
Confirmed same-day policy: record the new site IN and move the current roster; preserve the unclosed origin IN. The original site must supply actual leaving time and reason; supervisors may save a note without guessing a time. An office/admin user resolves the review only after the correction exists. Destination scan timestamps cannot be edited through this workflow. Corrections reconcile cumulative daily lunch across sites atomically.
Read-only live audit found one employee number shared by two records. Badge lookup, scan and timesheet imports now fail closed on ambiguous (case-insensitive) matches; the roster flags the code for office identity review. No automatic identity/history merge. Historical timesheet imports stamp the selected work site, even after the worker moves elsewhere.
Schema: additive GPS and review metadata applied with backups in scripts/data/backups/2026-10-17-workforce/. Existing attendance records were not changed. Batch API is enabled.
Validation: all six workforce routes checked at 1440×900 and 320×700; confirmation and correction dialogs checked at 320 px. Actual Excel download opened, numeric cached formulas inspected and worksheet ranges rendered; formula error scan found none. Camera/GPS were unavailable in this browser, so actual camera decoding and a physical phone GPS fix remain a field test. Existing hour records were not rewritten. Other leave/public holidays are not configured; only recorded sick notes and weekends are classified automatically.
Deployment: app code is local and uncommitted. Installed clock clients must refresh to send the destination site, confirmation token and request ID. Legacy writes are rejected with a refresh message rather than silently using the saved home site.
Final automated verification: 36 test files, 307 tests passed. TypeScript and targeted ESLint checks passed; git diff --check passed. Independent review findings (midnight confirmation and transferred-away roster presence) were fixed and covered by regressions. Historical-import site authority and duplicate badge handling received a further independent review with no findings.
Follow-up: workforce usability and export compatibility
- Fix workforce chart dark tooltip and hover cursor.
- Worker actions: change badge number, delete unused duplicates with history protection, compact detail header.
- Seven-day roster activity strip using recorded hours and sick notes, schedule-aware statuses.
- Timesheets default to today with site/employer aggregates and retained period filters.
- Explicit numeric H.MM Excel cells; minute-based total formulas for compatible viewers.
- Verify focused tests, typecheck, responsive browser views, workbook rendering and independent review.
No production worker deletion is authorized by this follow-up: add the reviewed action to the app. Removal rejects attendance/medical/rate/employer history and offers inactivity instead. Unused identities are retired with deleted_at and their original number retained; no physical employee deletion.
Follow-up verification: 37 test files / 345 tests passed; TypeScript and targeted ESLint passed; git diff --check clean. Browser checks covered the roster strip, actions and nested employer editor, compact detail, weekly history paging, today and weekly site/employer totals, 320px mobile page widths, and dark tooltip contrast. Excel rendered with no formula errors; forced independent LibreOffice recalculation confirmed a 12-minute edit carries through weekly and period totals. Additive employee metadata/index schema applied with prior schema backup; no live worker or attendance records edited for QA. App changes remain local/uncommitted and not deployed.