Skip to content

Display allocation warning during pending LSF approval (#622)#638

Open
DanielRukwasha wants to merge 2 commits into
allocation-card-real-data-rukfrom
622-allocation-warning-lsf-approval
Open

Display allocation warning during pending LSF approval (#622)#638
DanielRukwasha wants to merge 2 commits into
allocation-card-real-data-rukfrom
622-allocation-warning-lsf-approval

Conversation

@DanielRukwasha

Copy link
Copy Markdown

Closes #622

Adds a non-blocking over-allocation warning to the pending-LSF approval confirmation modal, so Labor Office admins can see the allocation impact before approving.

  • Extracted the allocation-counting logic from Create Current Allocation Card for the Department Portal #602's Department Portal card into a shared \�pp/logic/allocation.py\ (\getAllocationSummary, \getAllocationWarning), so this reuses the exact same 'used' counting (non-denied LaborStatusForms) instead of duplicating queries.
  • \modal_approval_and_denial_data()\ now returns one allocation warning per unique department among the selected forms, alongside the existing per-form table data.
  • The approval modal (\pendingApprovalModal.html\ / \�llPendingForms.js) renders a warning box per department: blue if within allocation, amber if any category is over. Positions and Break Hours are highlighted independently per the issue's requirement ('highlight any allocation categories that exceed'), since a department can be over on one and fine on the other.
  • Fixed a pre-existing demo-data gap found while testing: no student/supervisor was ever marked \isActive, so the approval checkbox (which requires both to be active) never rendered at all in this environment.

Branched off \�llocation-card-real-data-ruk\ (not \�llocation_card\ directly) since this depends on the allocation logic from #636, which hasn't merged yet.

Tested via direct API calls and in-browser: confirmed the warning shows correct numbers, confirmed the red/amber highlighting triggers independently for positions-only and break-hours-only over-allocation scenarios, and confirmed the full approve flow completes correctly end-to-end.

Extract allocation logic into app/logic/allocation.py (getAllocationSummary, getAllocationWarning), wire it into modal_approval_and_denial_data() to show a per-department warning box in the approval confirmation modal, and fix demo data so students/supervisors are marked active (needed for the approval checkbox to render at all).
isOverAllocated was a single combined flag, so a department over on one category but fine on the other would show the whole box the same way. Split into isPositionsOverAllocated / isBreakHoursOverAllocated so each metric line is highlighted (with an explicit warning marker, not just color) based on its own status.
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.

1 participant