Create a page for departments to view their allocations - #667
Conversation
…SoftwareDevTeam/lsf into allocation_table
| assert ['Elaheh','Guillermo','Jeremiah','Kat', 'Oluwagbayi', 'Test', 'Tyler'] == [s.FIRST_NAME for s in students] | ||
| assert ['718','300','420','420', '883', '700', '420'] == [s.STU_CPO for s in students] | ||
| for student in ['Elaheh','Guillermo','Jeremiah','Kat', 'Oluwagbayi', 'Test', 'Tyler']: | ||
| assert student in [s.FIRST_NAME for s in students] |
There was a problem hiding this comment.
This makes the Tracy test less strict.
The old test checked the exact returned names and CPOs. The new version only checks that each expected value appears somewhere, so it would still pass if extra students are returned or if names and CPOs no longer match the same records.
Can we keep this test stricter, or update it in a way that still verifies the full expected result?
There was a problem hiding this comment.
For the Semester Team
This change was originally meant to fix an extremely brittle test, which, thanks to my demo_data.py changes, now fails
There are a few ways to go around this, such as adding atomic students to the test rather than relying on existing database students, or checking a small subset of the data instead of the entire database.
This is the function that adds students to Tracy in demo_data.py; this could be used to make atomic students.
# Add students to Tracy db
with app.app_context():
for student in (tracyStudents + bothStudents):
db.session.add(STUDATA(**student))
db.session.commit()
# Add the Student records
students = []
for student in (localStudents + bothStudents):
# Set up lsf db data
del student["PIDM"]
student['ID'] = student['ID'].strip()
student['legal_name'] = student['FIRST_NAME'].strip()
del student['FIRST_NAME']
students.append(student)
Student.insert_many(students).on_conflict_replace().execute()
| @@ -1,6 +1,7 @@ | |||
| from flask import render_template, request, json, redirect, url_for, send_file, g, flash, jsonify | |||
| from peewee import JOIN, DoesNotExist, fn | |||
There was a problem hiding this comment.
The tables no longer resize, this was an issue caused by css having padding that would not update until the container was fully opened.
| from flask import render_template, request, json, redirect, url_for, send_file, g, flash, jsonify | ||
| from peewee import JOIN, DoesNotExist, fn | ||
| from functools import reduce | ||
| from datetime import datetime, date |
There was a problem hiding this comment.
Total Contracts row should have a tooltip or event like Primary + Secondary total Contract to show that total contracts mean a combination of both as here you have for both primary and secondary table and that can confuse anyone who are not familiar with the term contract as this isn't labor who is using it is all the departments and supervisor who might not be familiar with the term.
There was a problem hiding this comment.
Added a tool-tip to each category of the Total contracts which reads "Total Contracts shows the count for both Primaries and Secondaries for the term".
It may also be worthwhile to consider removing the Total Contracts from the secondaries table to avoid the redundancy.
| from app.logic.banner import Banner | ||
| from app.logic.getSupervisors import getSupervisors | ||
| from app.logic.getPositions import getActivePositions | ||
| from app.logic.allocationManager import getBreakContracts, getContractedAllocations, getTotalAllocations |
|
|
||
| currentDate = date.today() | ||
| if currentDate.month <= 6: | ||
| # If it is the spring semester, then the term code is 1 year behind. e.g. 2025-2026 term code is 202500. Thus the - 100 in the spring term. |
There was a problem hiding this comment.
can be in a logic file and have test, I am not going to require you as this is simple logic but many simple logic. However having different combination of math after currentDate.year means this can be turn into a logic function that determines the termcode and we will see similar termcode logic being use in other branches like allocation request.
|
Aside from the requested these are the scenarios I have checked and what i can say is it works, different term forms don't affect the current ay term display. when a lsf is submitted the display shows corrected and when i modify the form into different hours the display shows correctly too. |


Semester Team Info
Issue Description
Fixes issue #607
Additions
allocationTablehtml,css, andjs, all handle the UI.allocationTable.jsis needed because there are 6 Bootstrap DataTables on the page.Changes
main_routes.pyincludes a section that navigates to the pageallocationManager.pyfile includes 1 new function,getContractedAllocations(). This function gathers the number of hours for the break terms.demo_data.py,which include more LSFs, formHistory, students, and terms.Rationale
This logic depends on having access to a term that aligns with the current year.
main_routes.pycontains a function that retrieves the current date and uses its year-end to determine the current term.currentTermin the systemThe page will not physically load if there is no term for the current year.
The page also fails to load if there is no Allocation object for the current term.
Retrieving formHistory objects has a lot of nuance to it.
Contracts have many different ways that they can be written for only one term, including:
The Reasoning behind the complex query is that there are many different ways in which a Labor Status form differentiates term contracts, yearly contracts, and break contracts.
The Supervisors can pick whichever way they choose to build the Labor Status Form, and the function needs to be prepared to deal with all of the cases present.
Breaks are hard to justify their place in the table. As nice as they are, it is hard to see the information that someone may want at a given time
The current implementation has all of the break allocations for a selected term. The problem is the summer term.
Summer term starts after fall term.
Testing
INSERT INTO allocation (id, department_id, isFinal, termCode_id, justification, primary_10, primary_12, primary_15, primary_20, secondary_5, secondary_10, breakHours) VALUES (222, 2, 1, 202600, "ETAD allocation", 1,1,1,1,1,1,111); will give you an allocation for the ETAD department, which will load the page afterward.formHistoryandallocationssecret_config.yamltest_allocationManager.pytest is passing, most importantly.