Employee Fatigue Dashboard addition - #397
Conversation
|
Tested this locally. Main issue: the fatigue dashboard doesn't actually use the backend's existing fatigue logic (fatigue.service.js / assessGuardFatigue()). Instead it recalculates fatigue itself on the frontend using raw shift data from /shifts/myshifts. This means we now have two separate fatigue calculations that could give different results. Think this should be rebuilt to call a proper endpoint exposing the existing backend logic instead. |
|
This PR contains useful Employer Dashboard UI work, but it is not ready to merge because the fatigue calculation duplicates existing Backend logic and a date/time display issue has been identified. As the original contributor is no longer active on the project, this PR is being retained as a draft reference. A new focused ticket will recreate the feature from current main using one authoritative Backend fatigue calculation. Please do not merge or extend this branch directly. Relevant UI work may be reused with attribution in the replacement PR. |
This push introduces a Shift Fatigue Monitoring section to the Employer Dashboard that computes fatigue risk per guard from /shifts/myshifts. It normalizes shift data, parses dates or and times safely including ISO strings, and calculates shift duration. Guards are flagged as overworked when they have shifts ≥12 hours or rest gaps <12 hours between consecutive shifts. A “rest recommendation” score is derived from the shortest rest gap.