Skip to content

Wire Current Allocation card to real backend data (#602)#636

Open
DanielRukwasha wants to merge 4 commits into
allocation_cardfrom
allocation-card-real-data-ruk
Open

Wire Current Allocation card to real backend data (#602)#636
DanielRukwasha wants to merge 4 commits into
allocation_cardfrom
allocation-card-real-data-ruk

Conversation

@DanielRukwasha

Copy link
Copy Markdown

Related to #602

Replaces the hardcoded placeholder numbers on the Department Portal's 'Current Allocation' card with real data:

  • Fixed \database/migrate_db.sh, which was missing \�pp.models.allocation.Allocation\ entirely — the \�llocation\ table was never being created via migrations.
  • Added demo \Allocation\ seed rows per department (none existed before).
  • \departmentPortal()\ now queries the department's \Allocation\ row for the current open term, and computes real 'used' counts per hour-band (10/12/15/20 primary, 5/10 secondary) by counting non-denied \LaborStatusForm\s — reusing the same denied-filter pattern already used elsewhere in the app (\statusFormFunctions.py).
  • Added a best-effort 'break hours used' calculation (summed from \contractHours\ on break-term forms), since nothing previously tracked this.
  • Added 'Primary' / 'Secondary' section titles above the hour-band breakdown lists for clarity.
  • Removed the non-functional 'Request Allocation' button (no destination page exists yet) and relabeled 'AY' to 'Term' in the term display.

Not yet done / out of scope for this PR: the 'Manage Allocations' button still points nowhere (destination page depends on other open issues), and there's no access-control check restricting a department's allocation data to Labor admins + that department's own staff.

Tested locally end-to-end in the devcontainer against real seeded data across multiple departments.

…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

@MImran2002 MImran2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

your branch has conflict and is this final PR or draft PR

@DanielRukwasha DanielRukwasha requested a review from MImran2002 July 8, 2026 14:02
@DanielRukwasha

Copy link
Copy Markdown
Author

@MImran2002 this is the final PR, not a draft. The merge conflict is resolved now too — branch is up to date with allocation_card and mergeable/clean. Ready for another look whenever you get a chance.

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