Skip to content

changes in new-allocation-card - #654

Open
conwelld wants to merge 35 commits into
department-portal-basefrom
new-allocation-card
Open

changes in new-allocation-card#654
conwelld wants to merge 35 commits into
department-portal-basefrom
new-allocation-card

Conversation

@conwelld

@conwelld conwelld commented Jul 21, 2026

Copy link
Copy Markdown

Changes

  • Added summary to the view allocation card that changes based on demo data
  • Added more CSS styling to the HTML file
  • An additional function to getTerms.py for handling current term
  • Changed HTML to have card space for all three cards to be added
  • added demo data to students and forms so data looked more presentable
image image image

Rationale

  • Originally, this PR contained 2 additional files -> getAllocation.py and its test case.
    • These were removed as the new logic for getting allocations was merged into the main branch.
    • These files were unnecessarily adding more confusion to the code
  • Additional removals were decided based on being unnecessary
    • These include the information icon displaying the contracted / allocated, which is now fully demonstrated
    • 3 Additional file changes, such as migrate_db_tracy.sh, which were deemed unnecessary for the issue

Testing

  • Used 'flask run' to load the page, and everything shows up as it should
  • Reset the database, and no errors arose

@conwelld conwelld self-assigned this Jul 21, 2026
@conwelld
conwelld requested review from BetterRocket and fritzj2 July 21, 2026 14:59
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
@conwelld conwelld changed the title added changes from previous branch to avoid all files being commited new-allocation-card changes in new-allocation-card Jul 21, 2026
Comment thread app/static/css/departmentPortal.css Outdated
@conwelld

Copy link
Copy Markdown
Author

Thanks for looking into this. I have fixed the comments you have made (removed code from other branches and added comments to logic)

Comment thread app/static/css/departmentPortal.css Outdated
fritzj2

This comment was marked as outdated.

Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread database/demo_data.py Outdated
@BetterRocket

Copy link
Copy Markdown
Contributor

No logic file and tests needed yet because the logic related to pulling allocations and allocation utilization will be standardized by another team, whereupon this will have to be modified to use those functions.

…rvice.

  See #657 but beyond that we created allo files
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread database/reset_database.sh
Comment thread app/templates/main/departmentPortal.html Outdated
Comment thread app/templates/main/departmentPortal.html Outdated
Comment thread app/templates/main/departmentPortal.html Outdated
Comment thread app/templates/main/departmentPortal.html Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/logic/getAllocation.py Outdated
Comment thread database/migrate_db_tracy.sh Outdated
Comment thread tests/code/test_getAllocation.py Outdated

@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.

Image make sure the 5 hours and 10 hours stick to the top too instead of spread out

…SoftwareDevTeam/lsf into new-allocation-card

# Conflicts:
#	database/demo_data.py
getDepartmentAllocationSummary now calls allocationManager's
getTotalAllocations/getContractedAllocations instead of reimplementing the
same counts, removing countWorkers/getBreakHours and the manual Allocation
SUM query. Falls back to zeroed defaults for a most-recent term that only has
a draft allocation (no final row yet), and coalesces getContractedAllocations'
break_hours since its SQL SUM() can return None. Updated
test_getAllocation.py to match: removed the now-redundant countWorkers/
getBreakHours unit tests, updated the multi-row-allocation expectation to
reflect final-only summing, and added coverage for the draft-only fallback.
database/demo_data.py called LaborReleaseForm.insert(...) but never imported
the model, so any fresh database/reset_database.sh run failed with a
NameError partway through seeding demo data. Pre-existing bug from the
department-portal-base merge, unrelated to the allocation card changes.
…llocation

Root cause: allocationManager's getContractedAllocations called getAllocation
(isFinal=True only) for a value it never used, so any department whose most
recent term only has a draft (not yet final) Allocation row raised
DoesNotExist. getAllocation.py's earlier try/except caught that and fell back
to zeroed defaults, which is why real demo data (departments with only draft
allocations) started rendering 0s instead of their actual numbers.

- allocationManager.py: removed the dead getAllocation() call from
  getContractedAllocations. Also folded its break-hours query to filter by
  department directly in SQL instead of fetching every department's totals
  and picking the first match after grouping by (department, termCode) -
  that grouping meant a department with approved break hours under both the
  specific term and the academic-year "00" bucket term would silently keep
  only whichever row came back first instead of summing them. Coalesces the
  SQL SUM() to 0 instead of leaving it None.
- getAllocation.py: "allocated" is now summed directly from the Allocation
  rows already fetched for the most recent term (draft + final, matching the
  original pre-refactor behavior) instead of going through
  getTotalAllocations, which only looks at the final row. Dropped the
  DoesNotExist fallback - no longer needed now that the crash source is
  fixed at the root.
- Updated test_getAllocation.py's multi-row and draft-only cases to expect
  the correct summed/draft values instead of the zeroed fallback.
- Added two regression tests to test_allocationManger.py: getContractedAllocations
  without any Allocation row present, and break hours summed across a
  specific term and its academic-year bucket term.
@munsakad
munsakad force-pushed the new-allocation-card branch from 102ee32 to 77eabdf Compare August 5, 2026 18:53
@munsakad
munsakad force-pushed the new-allocation-card branch from 77eabdf to f3b43c6 Compare August 5, 2026 19:10
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/static/css/departmentPortal.css
@fritzj2 fritzj2 assigned Jonimz and fritzj2 and unassigned munsakad and DanielRukwasha Aug 27, 2026
@fritzj2 fritzj2 assigned Jonimz and fritzj2 and unassigned Jonimz and fritzj2 Aug 27, 2026
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.

7 participants