-
Notifications
You must be signed in to change notification settings - Fork 0
changes in new-allocation-card #654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
conwelld
wants to merge
24
commits into
department-portal-base
Choose a base branch
from
new-allocation-card
base: department-portal-base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
9bd90f6
added changes from previous branch to avoid all files being commited
conwelld 56d5a29
fixed some pr comments
conwelld faf1957
fixed some pr comments for css styling
conwelld 1204269
fixed useless code
conwelld 0f166c2
fixed department code
conwelld 6f5850a
We have change the hard coded part with variable able to be flexible …
813f398
Temporary allocation logic will be replaced by the official shared se…
7584ffa
fix the review comment from Minran, all of them
DanielRukwasha e9a4415
Merge branch 'department-portal-base' into new-allocation-card, resol…
DanielRukwasha 20b424c
Fix import after allocationUtilization rename to getAllocation, add i…
DanielRukwasha ee0e066
Address PR review comments: consolidate getAllocation return dict, ex…
DanielRukwasha 6abd704
Merge branch 'department-portal-base' into new-allocation-card, resol…
DanielRukwasha 8618b68
Adopt approval-status filtering from UsedAllocFunction branch in getA…
DanielRukwasha a0ba238
Polish the allocation card: dynamic Fall/Spring term label, "X of Y" …
munsakad 86bee45
Merge branch 'department-portal-base' into new-allocation-card
munsakad 45b13e0
Fix duplicate main.managePositions endpoint left over from the depart…
munsakad 74bdd3a
Rework allocation rows to the "N hr: X contracts (out of Y allocation…
munsakad a7ca474
Address allocation card review: camelCase naming, stacked layout, con…
munsakad c7ef1ec
Merge branch 'department-portal-base' of https://github.com/BCStudent…
munsakad 25d9a9b
Reuse allocationManager.py in getAllocation.py
munsakad f5640b3
Fix missing LaborReleaseForm import in demo_data.py
munsakad 4c17019
Fix allocation card showing zeros for departments with only a draft a…
munsakad f3b43c6
removed unneccesary comments
munsakad 6ae3931
removed department information in main routes
munsakad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| from datetime import date | ||
|
|
||
| from app.logic.allocationManager import getContractedAllocations | ||
| from app.models.allocation import Allocation | ||
|
DanielRukwasha marked this conversation as resolved.
|
||
| from app.models.term import Term | ||
|
DanielRukwasha marked this conversation as resolved.
|
||
|
|
||
|
|
||
| def getCurrentSemesterLabel(term): | ||
| """Return the Fall/Spring label (e.g. "Fall 2025") for the AY term's | ||
| current semester, picking the season from today's month.""" | ||
| if not term: | ||
| return None | ||
| academicYear = int(str(term.termCode)[:4]) | ||
| if date.today().month >= 8: | ||
| return f"Fall {academicYear}" | ||
| return f"Spring {academicYear + 1}" | ||
|
|
||
|
|
||
| def getDepartmentAllocationSummary(department): | ||
| """Return allocation-utilization values for a department's most recent term.""" | ||
| result = { | ||
| "term": None, | ||
| "currentSemester": None, | ||
| "allocated": 0, | ||
| "used": 0, | ||
| "usedPositions": { | ||
| "used10": 0, | ||
| "used12": 0, | ||
| "used15": 0, | ||
| "used20": 0, | ||
| "usedSecondary5": 0, | ||
| "usedSecondary10": 0, | ||
| }, | ||
| "breakHours": 0, | ||
| } | ||
|
munsakad marked this conversation as resolved.
|
||
|
|
||
| departmentAllocations = list( | ||
| Allocation.select(Allocation, Term).join(Term).where(Allocation.department == department) | ||
| ) | ||
| if not departmentAllocations: | ||
| return result | ||
|
|
||
| recentTerm = Term.order_by_term([a.termCode for a in departmentAllocations], reverse=True)[0] | ||
| termCode = recentTerm.termCode | ||
| result["term"] = recentTerm | ||
| result["currentSemester"] = getCurrentSemesterLabel(recentTerm) | ||
|
|
||
| # "allocated" is summed directly from the rows already fetched above rather | ||
| # than through allocationManager's getTotalAllocations, since that only | ||
| # looks at the *final* Allocation row for a term - a department whose most | ||
| # recent term is still a draft (isFinal=False, no final row yet) would | ||
| # otherwise show 0 allocated instead of its draft numbers. | ||
| recentTermAllocations = [a for a in departmentAllocations if a.termCode_id == termCode] | ||
| result["allocated"] = sum( | ||
| a.primary_10 + a.primary_12 + a.primary_15 + a.primary_20 + a.secondary_5 + a.secondary_10 | ||
| for a in recentTermAllocations | ||
| ) | ||
|
|
||
| contractedAllocations = getContractedAllocations(termCode, department.departmentID) | ||
| result["used"] = contractedAllocations["used_total"] | ||
| result["usedPositions"] = { | ||
| "used10": contractedAllocations["used_10"], | ||
| "used12": contractedAllocations["used_12"], | ||
| "used15": contractedAllocations["used_15"], | ||
| "used20": contractedAllocations["used_20"], | ||
| "usedSecondary5": contractedAllocations["used_5_sec"], | ||
| "usedSecondary10": contractedAllocations["used_10_sec"], | ||
| } | ||
| result["breakHours"] = contractedAllocations["break_hours"] | ||
|
|
||
| return result | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,64 @@ | |
| font-size: 3rem; | ||
| color:#6e6e6e; | ||
| } | ||
| .bi-clock { | ||
|
munsakad marked this conversation as resolved.
|
||
| border: 1px solid #c0c0c0; | ||
| border-radius: 8px; | ||
| padding: 3px 3.5px 1.5px 3.5px; | ||
| font-size: 3rem; | ||
| color:#6e6e6e; | ||
| } | ||
| .bi-info-circle { | ||
| padding: 3px 3.5px 1.5px 3.5px; | ||
| font-size: 1.5rem; | ||
| vertical-align: middle; | ||
| color:#6e6e6e; | ||
| } | ||
| .allocation-table-wrapper { | ||
| overflow-x: auto; | ||
| margin: 10px 0; | ||
| } | ||
| .allocation-summary { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| justify-content: space-between; | ||
| align-items: baseline; | ||
| gap: 0 1rem; | ||
| } | ||
| .allocation-summary h4 { | ||
| margin: 10px 0; | ||
| } | ||
| .allocation-columns { | ||
| display: flex; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| flex-wrap: wrap; | ||
| gap: 0 2rem; | ||
| } | ||
| .allocation-table { | ||
| /* wraps onto its own line when the card is too narrow, instead of shrinking */ | ||
| flex: 1 1 180px; | ||
| border-collapse: collapse; | ||
| font-size: 1.2em; | ||
| } | ||
| .allocation-table th, | ||
| .allocation-table td { | ||
| text-align: left; | ||
| white-space: nowrap; | ||
| padding: 4px 10px 4px 0; | ||
| line-height: 1.3; | ||
| } | ||
| .allocation-table th { | ||
| font-weight: 700; | ||
| padding-top: 10px; | ||
| } | ||
|
|
||
| .bi-people-fill { /* Bootstrap Icon for Members Card */ | ||
| border: 1px solid #c0c0c0; | ||
| border-radius: 8px; | ||
| padding: 3px 3.5px 1.5px 3.5px; | ||
| font-size: 3rem; | ||
| color:#6e6e6e; | ||
| } | ||
|
|
||
| .card-group { | ||
| gap: 1rem; | ||
| } | ||
|
|
@@ -52,3 +110,15 @@ | |
| flex-direction: column; | ||
| } | ||
| } | ||
|
|
||
| /* Narrow card: stack Secondary below Primary, and the position count below the | ||
| term, rather than shrinking the text to keep them side by side. */ | ||
| @media (min-width: 1200px) and (max-width: 1450px), (max-width: 480px) { | ||
| .allocation-summary { | ||
| flex-direction: column; | ||
| gap: 0; | ||
| } | ||
| .allocation-columns .allocation-table { | ||
| flex-basis: 100%; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I have comment on this before if we are rendering allocationsummary with multiple variables we can just send the allocationsummary to jinja and use {{ allocatedsummary.allocated }} to access the elements inside while in the macros like {% macro allocationRow(hours, used, allocationsummary) -%}
you just use allocationsummary instead