Skip to content

Add over-allocation warning on labor status form (#615) - #646

Open
DanielRukwasha wants to merge 14 commits into
department-portal-basefrom
615-over-allocation-warning-lsf-creation
Open

Add over-allocation warning on labor status form (#615)#646
DanielRukwasha wants to merge 14 commits into
department-portal-basefrom
615-over-allocation-warning-lsf-creation

Conversation

@DanielRukwasha

Copy link
Copy Markdown

Closes #615. Shows a non-blocking allocation warning when creating a labor status form that would put the department over its allocation for the selected job type/hours band.

…602)

Fix migrate_db.sh missing the Allocation model, seed demo Allocation rows per department, and query real allocated/used position counts and break hours in departmentPortal() instead of hardcoded placeholder numbers.
…-card-real-data-ruk

# Conflicts:
#	app/controllers/main_routes/main_routes.py
#	app/templates/main/departmentPortal.html
#	database/demo_data.py
#	database/migrate_db.sh
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.
…llocated

Complements the pre-approval modal warning: after a Pending LSF is approved, check the affected department's allocation and flash a warning (non-blocking) if it's now over its allocated positions or break hours. Reuses getAllocationWarning() from #602/#622's shared allocation logic.
Imran found that approving forms into a specific band (e.g. 10 Hour Primary, allocated 1) past its limit showed no warning, because isPositionsOverAllocated only compared the aggregate total across all 6 bands. A department can be under its total while one band is individually over. getAllocationWarning() now also flags any band where used > allocated, and both the pre-approval modal and the post-approval flash name the specific band(s) that are over instead of just the misleading aggregate number.

Also removed docstrings that were flagged as too explicit in review.
…-allocation-warning-lsf-approval

# Conflicts:
#	app/models/allocation.py
#	app/models/positionHistory.py
#	database/demo_data.py
…ation-warning-lsf-creation

# Conflicts:
#	app/static/css/base.css
@BrianRamsay
BrianRamsay changed the base branch from development to department-portal-base July 27, 2026 13:19
@BrianRamsay

Copy link
Copy Markdown
Contributor

Merge conflicts with integration branch

Comment thread app/controllers/main_routes/laborStatusForm.py Outdated
Comment thread app/controllers/main_routes/laborStatusForm.py Outdated
Comment thread app/controllers/main_routes/main_routes.py
Comment thread app/logic/allocation.py Outdated
Comment thread app/logic/allPendingForms.py
Comment thread app/static/js/allPendingForms.js
Comment thread app/static/js/laborStatusForm.js
Comment thread app/templates/main/departmentPortal.html Outdated
…g-lsf-creation, resolve conflicts with the new Members card feature
…eature

checkAllocation now sends department/job/hours as a data dictionary and returns a proper HTTP error instead of jsonify(None). Removed out-of-scope allocation code from departmentPortal, reverted departmentPortal.html and main_routes.py to match department-portal-base exactly. Reduced app/logic/allocation.py to two core functions adapted from allocationManager.py, keeping thin wrappers for existing callers. Fixed the allocation warning box styling and title in allPendingForms.js.
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.

Display Over-Allocation Warnings During LSF Creation

3 participants