Skip to content

changes in new-allocation-card - #654

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

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

Conversation

@conwelld

Copy link
Copy Markdown

Allocation card revert merge

  • There was no way to access an allocation card from the department portals page, where one could view a summary of their allocations and click a view allocation button.

Changes

  • Added summary to the view allocation card that changes based on demo data
  • Added CSS styling to the HTML file
  • added allocation logic to the main routed file that iterates through labor status forms
  • 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
  • added information icon to AY as well as the break hours to give more context to what users are seeing.
  • added CSS styling to make the information icon
  • added JavaScript to allow for Bootstrap tooltips
  • added css styling that changes based on window size
image image image

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
Comment thread app/logic/getAllocation.py Outdated
Comment thread app/logic/getAllocation.py Outdated
Comment thread app/logic/getAllocation.py Outdated
Comment thread database/base_data.py Outdated
Comment thread database/demo_data.py Outdated
Comment thread database/demo_data.py
Comment thread database/demo_data.py
Comment thread app/logic/getAllocation.py
…tract countWorkers/getBreakHours with FormHistory approval filter, dynamic term in departmentPortal.html, and revert environment-specific path edits in base_data.py/demo_data.py. Add integration test coverage for the new logic functions.
…ve conflicts with the new Members card feature
@DanielRukwasha
DanielRukwasha requested review from MImran2002 and removed request for fritzj2 July 30, 2026 14:21
DanielRukwasha and others added 5 commits July 30, 2026 11:12
…llocation.py, excluding denied forms from countWorkers and the used count. Update tests to cover the new behavior.
…wording, and aligned Primary/Secondary table

Replace the raw "AY 2025-2026" term name with a computed current-semester
label (e.g. "Fall 2025") derived from the term's own year and today's month,
matching the Fall/Spring termCode convention used elsewhere. Reword ratios
as "X of Y" instead of "X/Y", rename the card title to "Current Allocation",
and rebuild the Primary/Secondary breakdown as a single table so every row
(term info, headers, hour buckets, break hours) shares the same column
alignment and stays legible down to mobile widths.
…ment-portal-base merge

The base branch (department-portal-base) moved managePositions out of
main_routes.py into its own departmentPortal.py with proper permission
checks (commit ee19d87), but merging that branch in and accepting both
sides left the old, now-dead copy in main_routes.py alongside the new
file, so Flask registered two view functions under the same endpoint
name and crashed on startup with "View function mapping is overwriting
an existing endpoint function: main.managePositions". Remove the stale
duplicate (it also referenced an unimported Tracy class) and the
duplicate departmentPortal import in __init__.py from the same merge.
…s)" format and drop Break Hours

Match the supervisor's whiteboard mockup: each Primary/Secondary hour
bucket now reads as two lines ("10 hr: 2 contracts" / "(out of 5
allocations)") with correct singular/plural wording, via a small Jinja
macro to avoid repeating the format six times. Break Hours is removed
from the card entirely. Column alignment (left edges shared across the
term row, headers, and hour rows) is unchanged, and the pinch-zone
media query is retuned for the new, longer per-row text so nothing
clips or overflows at narrow widths.
Comment thread app/static/css/departmentPortal.css
Comment thread app/templates/main/departmentPortal.html Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/logic/getAllocation.py Outdated
Comment thread app/logic/getAllocation.py Outdated
Comment thread tests/code/test_getAllocation.py Outdated
Comment thread tests/code/test_getAllocation.py Outdated
Comment thread tests/code/test_getAllocation.py Outdated
…solidated tests

- Rename allocation_summary and its snake_case keys/locals to camelCase
  (allocationSummary, currentSemester, usedPositions, breakHours, used10,
  usedSecondary5, ...) across the logic, route, template, and tests
- Shorten the getCurrentSemesterLabel docstring
- Reword the card to Contracted/Allocated in both the tooltip and the
  position count
- Stack Secondary below Primary (and the count below the term) on narrow
  cards by splitting the paired table into two, instead of shrinking the font
- Point the not-yet-built View Allocations page at "#" like the Members card,
  so the button no longer 404s
- Collapse the per-scenario tests into one test per function, drop the
  leading underscore from createFormHistory, and mark the unit test so
  run_tests.sh stops deselecting it
- Cover the used-count denial filter and make the term filter and the
  getBreakHours other-term assertion actually meaningful
- Revert unrelated whitespace/formatting churn in main_routes.py
Comment thread app/controllers/main_routes/main_routes.py Outdated
Comment thread app/logic/getAllocation.py
Comment thread database/migrate_db_tracy.sh
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
departments = departments,
department = dept,
allocation = allocation,
allocated = allocationSummary["allocated"],

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.

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

margin: 10px 0;
}
.allocation-columns {
display: flex;

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 secondary hours are on the top and not evenly space

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.

6 participants