Skip to content

Integrate Employer Fatigue Dashboard with Backend Fatigue Logic - #494

Open
allistyre wants to merge 4 commits into
mainfrom
feature/backend-fatigue-dashboard
Open

Integrate Employer Fatigue Dashboard with Backend Fatigue Logic#494
allistyre wants to merge 4 commits into
mainfrom
feature/backend-fatigue-dashboard

Conversation

@allistyre

@allistyre allistyre commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

This push builds from the Shift Fatigue Monitoring section from PR #397 and instead integrates the Employer Fatigue Dashboard with the existing backend fatigue logic, replacing the duplicated frontend fatigue calculations identified in PR #397

Changes

  • Added an employer fatigue dashboard backend endpoint.
  • Removed duplicated frontend fatigue calculations
  • Fixed the incorrect date/time display in the fatigue modal/card highlighted in the PR review
  • Added loading, error and empty states
  • Current guard fatigue assessment based on assigned/completed shifts
  • Preserved the existing fatigue dashboard and the details modal whilst adding a Warnings and Current Workload section

Testing

  • Normal guard displays no fatigue warning
  • Fatigued guard displays a daily hour warning
  • No monitored guards shows correctly
  • Duplicate guard IDs are handled
  • Loading state and an error state
  • Date/time works and modal works and details are shown

@allistyre

Copy link
Copy Markdown
Collaborator Author

The latest main conflicts have been resolved and all CI checks have passed

@allistyre
allistyre requested a review from LoopyB August 12, 2026 07:21

@LoopyB LoopyB left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alli, this is great work and the overall approach looks solid. Thanks for your amazing effort in getting this done. The Backend is now the source of truth for fatigue calculations and the duplicated Frontend fatigue logic has been removed.

I’ve found one blocking issue before merge:

  • /shifts/fatigue is currently declared after /:id, so Express may match "fatigue" as the shift ID and never reach the fatigue controller. Please could you move the static /fatigue route above /:id.

I’d also like a few focused automated tests around the new endpoint, particularly:

  • route resolution;
  • employer authorization/scoping;
  • normal/fatigued/empty scenarios.

There are a couple of smaller non-blocking comments around the modal/date handling and formatting churn, but the core architecture is sound.

Once the route and focused tests are done, I’m happy to review again. Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants