Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
4a7be6c
edited supervisorDepartment
BetterRocket Jun 30, 2026
12d8d41
edited supervisorDepartment
BetterRocket Jun 30, 2026
a868455
added the position history file
brightfietsop-ux Jun 30, 2026
83c8c92
added the allocation model
johnlolonga19 Jun 30, 2026
caad7d3
Added dummy data: weren't able to check if they work though
nahom70 Jun 30, 2026
bea1a8c
changed migrate_db.sh data to add PositionHistory, and added dummy da…
conwelld Jun 30, 2026
2978b55
allocation table added
johnlolonga19 Jun 30, 2026
912f50f
dummy allocations added
BetterRocket Jun 30, 2026
a61ff1d
Successfully added dummy data for the SupervisorDepartment class
ArtemKurasov Jun 30, 2026
cebf62e
Inserted the demo data
BhushanSah Jul 1, 2026
539efde
added a second round of demo data to the allocation
fritzj2 Jul 1, 2026
6d58afd
We added more data for position history
Jul 1, 2026
e670c2f
fixed the demo_data to make it easier to merge, and fixed the positio…
conwelld Jul 1, 2026
4c3f875
fixed demo data to fit pre existing format
conwelld Jul 1, 2026
6666512
fixed formating
Jul 1, 2026
0d517a9
fixed formating again
Jul 1, 2026
e5869bb
fixed merge conflict
Jul 1, 2026
ad3c194
Merge branch 'PeeWeeAttribute_PosHis' into Nahom_Dee_Alpha_peeweeAttr…
munsakad Jul 1, 2026
c953725
Merge pull request #597 from BCStudentSoftwareDevTeam/Nahom_Dee_Alpha…
munsakad Jul 1, 2026
49b5eac
Modified allocation
BhushanSah Jul 1, 2026
ea12fae
Merge branch 'allocation_demoData_JJ' into PeeWeeAttribute-CG-BS
BhushanSah Jul 1, 2026
5545996
Merge pull request #600 from BCStudentSoftwareDevTeam/PeeWeeAttribute…
BhushanSah Jul 1, 2026
30c5fe9
fixed the format issue on demo data and made the composite key on pos…
conwelld Jul 1, 2026
364a5e3
Merge pull request #601 from BCStudentSoftwareDevTeam/allocation_demo…
BhushanSah Jul 1, 2026
9b7e778
changed meta class in position history adn fixed identifiers in demo …
conwelld Jul 1, 2026
5c027e3
Resolved the merge conflict with the demo data
ArtemKurasov Jul 1, 2026
a52eeca
Add base for department portal
BrianRamsay Jul 2, 2026
0ebcfd7
Fix menu item highlighting for dept portal
BrianRamsay Jul 2, 2026
ba5a40b
Add empty file for common routes
BrianRamsay Jul 2, 2026
7c1adec
Added member card
BhushanSah Jul 2, 2026
cc07c97
tried to add it
nahom70 Jul 2, 2026
6bb3e68
some change
conwelld Jul 2, 2026
c29f01f
added 3 sample buttons to learn HTML
johnlolonga19 Jul 2, 2026
aa3a837
uniform sizing for cards that scale with the screen and no cards when…
fritzj2 Jul 3, 2026
645e85a
added a 10 position cap to the amount of visible positons
fritzj2 Jul 3, 2026
d3c0b04
removed an unecessary print statement from the main_routes.py
fritzj2 Jul 3, 2026
5c6f767
Merge remote-tracking branch 'origin/dp-position-card' into manage_po…
NYABUTOA Jul 3, 2026
dfa5971
we added some things and the table we hard coded
NYABUTOA Jul 3, 2026
213848c
Merge branch 'card1-alloc' into dp-position-card
fritzj2 Jul 3, 2026
693191b
got the first card added from Dayton's branch
fritzj2 Jul 3, 2026
f00b0fa
merged members card and removed unused css from base
fritzj2 Jul 3, 2026
1bb8c18
added real people into the members card, its wrong and gives us everyone
fritzj2 Jul 3, 2026
3f6aa59
changed the button from members to blue
fritzj2 Jul 6, 2026
77e9714
added the bottom border and centered the button
fritzj2 Jul 6, 2026
abcd951
Add real data to the Current Allocation card
DanielRukwasha Jul 6, 2026
6c52ca9
fixedgit add app/controllers/main_routes/main_routes.py Now current d…
BhushanSah Jul 6, 2026
f26adc4
Merge branch 'dp-position-card' of https://github.com/BCStudentSoftwa…
BhushanSah Jul 6, 2026
cdabc2a
added changes to format with all 3 cards
conwelld Jul 6, 2026
ea79ff6
unordered list now bullets elements, icon is in the top right, and ro…
fritzj2 Jul 6, 2026
4cd48d8
Merge branch 'manage_positions_ADN' into dp-position-card
fritzj2 Jul 6, 2026
b75e822
Revert "Add real data to the Current Allocation card"
DanielRukwasha Jul 6, 2026
b1e8ee2
made changes so three cards show up
conwelld Jul 6, 2026
68c055b
Merge branch 'card1-alloc' of https://github.com/BCStudentSoftwareDev…
conwelld Jul 6, 2026
827becc
gitMerge branch 'dp-position-card' of https://github.com/BCStudentSof…
fritzj2 Jul 6, 2026
e975c48
Merge branch 'development' of https://github.com/BCStudentSoftwareDev…
fritzj2 Jul 6, 2026
c1ffd57
fixed supervisor for members card
BhushanSah Jul 6, 2026
3b800cf
merged new version of managepositions into our branch, fixed the main…
fritzj2 Jul 6, 2026
eb0b99f
Merge branch 'dp-position-card' of https://github.com/BCStudentSoftwa…
fritzj2 Jul 6, 2026
725ce6a
polished the UI
nahom70 Jul 6, 2026
5a585e3
Merge pull request #624 from BCStudentSoftwareDevTeam/dp-position-card
nahom70 Jul 6, 2026
f5b4976
began formatting allocation card for pull request draft
conwelld Jul 6, 2026
eacbf27
removed some hardcoded css, fixed the icon
fritzj2 Jul 6, 2026
c3b577a
merge commit with the allocation branch
fritzj2 Jul 6, 2026
dbb1bd1
Revert "merge commit with the allocation branch"
fritzj2 Jul 6, 2026
3bcc164
refixed the icon, added an if statement for the No positions edge case
fritzj2 Jul 6, 2026
f759f54
began fixing the position of the current alloc icon.
fritzj2 Jul 6, 2026
c343599
Merge pull request #632 from BCStudentSoftwareDevTeam/PeeWeeAttribute
nahom70 Jul 6, 2026
c768d7b
added format changes to match the 3 cards and corrected color
conwelld Jul 6, 2026
0f137c0
merge commit with PeeWeeAttribute, creates a nested meta class
conwelld Jul 6, 2026
c304338
Merge branch 'PeeWeeAttribute' into allocation_card
conwelld Jul 6, 2026
05bd744
Merge pull request #596 from BCStudentSoftwareDevTeam/PeeWeeAttribute…
MImran2002 Jul 6, 2026
ae3189a
Dynamic data from Tracy
nahom70 Jul 6, 2026
62d5a13
added changes from demo
conwelld Jul 7, 2026
ab3bfb9
Merge branch 'manage_positions_ADN' into PeeWeeAttribute
nahom70 Jul 7, 2026
ffe248f
Fix duplicate style attribute and stray backslash in departmentPortal…
DanielRukwasha Jul 7, 2026
b4d408f
Wire Current Allocation card to real Allocation/LaborStatusForm data …
DanielRukwasha Jul 7, 2026
0d1dad4
Remove Request Allocation button and relabel AY as Term on allocation…
DanielRukwasha Jul 7, 2026
747a75e
Add Primary/Secondary titles above the hour-band breakdown lists
DanielRukwasha Jul 7, 2026
fd01b32
attempting to get back end communication
conwelld Jul 7, 2026
b5fff5f
Merge branch 'PeeWeeAttribute' of https://github.com/BCStudentSoftwar…
conwelld Jul 7, 2026
e3572c5
made real data show up on card and changed demo data to work
conwelld Jul 7, 2026
d7f6ccf
resolved department portal merge conflict
conwelld Jul 7, 2026
391728a
Merge remote-tracking branch 'origin/allocation_card' into allocation…
DanielRukwasha Jul 8, 2026
0d64daf
Add allocation warning to pending LSF approval modal (#622)
DanielRukwasha Jul 8, 2026
ac0ace0
Highlight positions and break hours independently in allocation warning
DanielRukwasha Jul 8, 2026
3cd1205
Added new model requiremetns
BrianRamsay Jul 8, 2026
a57e055
Add new DDL to prod backup
BrianRamsay Jul 8, 2026
a6e09db
Fix failing admin management tests
BrianRamsay Jul 8, 2026
2de8e2b
Fix failing tests - missing Term, and new tracy setup reqs
BrianRamsay Jul 8, 2026
4203dc5
Fixed remaining failing tests
BrianRamsay Jul 8, 2026
cfd9ee9
Merge pull request #640 from BCStudentSoftwareDevTeam/add-models
BrianRamsay Jul 8, 2026
97f05f5
Add option to run just one file
BrianRamsay Jul 8, 2026
10ae9a2
Merge branch 'department-portal-base' of github.com:BCStudentSoftware…
BrianRamsay Jul 8, 2026
78df419
merging changes from brian branch
conwelld Jul 9, 2026
a08e85e
fixed semantic bug in demo data, changed current_year to hardcoded data
conwelld Jul 9, 2026
9522be3
fixed semantic bug in demo data, changed current_year to hardcoded da…
conwelld Jul 9, 2026
ca34008
Flash a warning after approving forms if the department is now over-a…
DanielRukwasha Jul 9, 2026
653ae75
fixed merge issues
conwelld Jul 9, 2026
8ad22e0
fixed merge issues
conwelld Jul 10, 2026
035cda0
Fix over-allocation check to look at each hour-band, not just the total
DanielRukwasha Jul 10, 2026
64e49b8
fixed test error
conwelld Jul 10, 2026
0369e4a
Merge pull request #643 from BCStudentSoftwareDevTeam/demoDataFix_dpb
MImran2002 Jul 10, 2026
f71b525
Merge remote-tracking branch 'origin/department-portal-base' into 622…
DanielRukwasha Jul 10, 2026
3ff622a
Add over-allocation warning on labor status form (#615)
DanielRukwasha Jul 13, 2026
b148007
Merge remote-tracking branch 'origin/development' into 615-over-alloc…
DanielRukwasha Jul 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/main_routes/departmentPortal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from flask import render_template
12 changes: 11 additions & 1 deletion app/controllers/main_routes/laborStatusForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
from flask import json, jsonify
from flask import request
from datetime import datetime, date, timedelta
from flask import Flask, redirect, url_for, flash
from flask import Flask, redirect, url_for, flash, g
from app.logic.emailHandler import*
from app.logic.userInsertFunctions import*
from app.models.supervisor import Supervisor
from app.logic.tracy import Tracy
from app.controllers.main_routes.laborReleaseForm import createLaborReleaseForm
from app.logic.allPendingForms import saveStatus
from app.logic.statusFormFunctions import *
from app.logic.allocation import getBandAllocationStatus


@main_bp.route('/laborstatusform', methods=['GET'])
Expand Down Expand Up @@ -170,6 +171,15 @@ def checkTotalHours(termCode, student, hours):
totalHours = totalHours + int(hours)
return json.dumps(totalHours)

@main_bp.route("/laborstatusform/checkallocation/<departmentOrg>/<departmentAcct>/<jobType>/<hours>", methods=["GET"])
def checkAllocation(departmentOrg, departmentAcct, jobType, hours):
""" Checks the department's allocation status for the hour-band being submitted. """
dept = Department.get_or_none(Department.ORG == departmentOrg, Department.ACCOUNT == departmentAcct)
if not dept:
return jsonify(None)
status = getBandAllocationStatus(dept, g.openTerm, jobType, int(hours))
return jsonify(status)

@main_bp.route("/laborStatusForm/modal/releaseAndRehire", methods=['POST'])
def releaseAndRehire():
try:
Expand Down
70 changes: 66 additions & 4 deletions app/controllers/main_routes/main_routes.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
from flask import render_template, request, json, redirect, url_for, send_file, g, flash, jsonify
from peewee import JOIN
from peewee import JOIN, DoesNotExist
from functools import reduce
import operator
from app.models.department import Department
from app.models.supervisor import Supervisor
from app.models.supervisorDepartment import SupervisorDepartment
from app.models.student import Student
from app.models.laborStatusForm import LaborStatusForm
from app.models.formHistory import FormHistory
from app.models.term import Term
from app.controllers.admin_routes.allPendingForms import checkAdjustment
from app.controllers.main_routes import main_bp
from app.logic.download import CSVMaker, saveFormSearchResult, retrieveFormSearchResult
from app.logic.search import getDepartmentsForSupervisor, searchPerson, searchSupervisorPortal
from app.login_manager import require_login, logout
from app.logic.getTableData import getDatatableData
from app.logic.banner import Banner
from app.logic.tracy import Tracy
from app.logic.allocation import getAllocationSummary

@main_bp.route('/logout', methods=['GET'])
def triggerLogout():
Expand Down Expand Up @@ -47,6 +47,67 @@ def supervisorPortal():
currentUser = currentUser
)

@main_bp.route('/department', methods=['GET'])
@main_bp.route('/department/<org>', methods=['GET'])
@main_bp.route('/department/<org>/<account>', methods=['GET'])
def departmentPortal(org=None,account=None):
if org and account:
try:
dept = Department.get(Department.ORG == org, Department.ACCOUNT == account)
except (NameError, DoesNotExist):
dept = None
else:
dept = None

if g.currentUser.isLaborAdmin:
departments = list(Department.select().order_by(Department.isActive.desc(), Department.DEPT_NAME.asc()))
else:
departments = list(getDepartmentsForSupervisor(g.currentUser).order_by(Department.isActive.desc(), Department.DEPT_NAME.asc()))

pos = Tracy().getPositionsFromDepartment(org, account)
positions = []
if pos == []:
positions = ["No Positions for this Department"]
else:
for i in pos:
positions.append(i.POSN_TITLE + "" + "(" + i.WLS + ")")

staff = Tracy().getSupervisors()
supervisors = []

for i in staff:
if i.ORG == org:
supervisors.append(i.FIRST_NAME + " " + i.LAST_NAME + " (" + i.EMAIL + ")")

allocationSummary = getAllocationSummary(dept, g.openTerm)

return render_template('main/departmentPortal.html',
departments = departments,
department = dept,
positions = positions,
supervisors = supervisors,
allocation = allocationSummary['allocation'],
allocationBands = allocationSummary['allocationBands'],
totalPositionsAllocated = allocationSummary['totalPositionsAllocated'],
totalPositionsUsed = allocationSummary['totalPositionsUsed'],
breakHoursUsed = allocationSummary['breakHoursUsed'],
currentTerm = g.openTerm)

@main_bp.route('/department/<org>/<account>/managepositions', methods=['GET'])
def managePositions(org, account):
try:
dept = Department.get(Department.ORG == org, Department.ACCOUNT == account)
except DoesNotExist:
return render_template('errors/404.html'), 404

positions = Tracy().getPositionsFromDepartment(org, account)
print(positions)
return render_template('main/managepositions.html',
department = dept,
department_name = dept.DEPT_NAME,
positions = positions
)

@main_bp.route('/supervisorPortal/addUserToDept', methods=['GET', 'POST'])
def addUserToDept():
userDeptData = request.form
Expand Down Expand Up @@ -113,4 +174,5 @@ def submitToBanner(formHistoryId):
if save_form_status:
return "Form successfully submitted to Banner.", 200
else:
return "Submitting to Banner failed.", 500
return "Submitting to Banner failed.", 500

32 changes: 26 additions & 6 deletions app/logic/allPendingForms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from datetime import date
from flask import jsonify
from flask import jsonify, g, flash
from app.models.formHistory import FormHistory
from app.models.status import Status
from app.logic.banner import Banner
Expand All @@ -14,9 +14,11 @@
from app.models.overloadForm import OverloadForm
from app.models.notes import Notes
from app.login_manager import DoesNotExist, render_template
from app.logic.allocation import getAllocationWarning


def saveStatus(new_status, formHistoryIds, currentUser):
approvedDepartments = {}
try:
if new_status == 'Denied by Admin':
# Index 1 will always hold the reject reason in the list, so we can
Expand Down Expand Up @@ -66,6 +68,8 @@ def saveStatus(new_status, formHistoryIds, currentUser):
email.laborStatusFormRejected()
if new_status == "Approved" and formType == "Labor Status Form":
email.laborStatusFormApproved()
dept = formHistory.formID.department
approvedDepartments[dept.departmentID] = dept
if new_status == "Approved" and formType == "Labor Adjustment Form":
# This function is triggered whenever an adjustment form is approved.
# The following function overrides the original data in lsf with the new data from adjustment form.
Expand All @@ -80,6 +84,16 @@ def saveStatus(new_status, formHistoryIds, currentUser):
print("Error preparing form for status update:", e)
return jsonify({"success": False}), 500

# After approving, let the admin know right away if any affected department
# is now over its allocated positions or break hours (informational only).
for dept in approvedDepartments.values():
warning = getAllocationWarning(dept, g.openTerm)
if warning and warning['isOverAllocated']:
messageParts = [f"{b['label']} ({b['used']}/{b['allocated']})" for b in warning['overAllocatedBands']]
if warning['isBreakHoursOverAllocated']:
messageParts.append(f"break hours ({warning['breakHoursUsed']}/{warning['breakHoursAllocated']})")
flash(f"{dept.DEPT_NAME} is now over its allocation for: {', '.join(messageParts)}.", "warning")

return jsonify({"success": True})

def overrideOriginalStatusFormOnAdjustmentFormApproval(form, LSF):
Expand Down Expand Up @@ -196,9 +210,8 @@ def laborAdminOverloadApproval(rsp, historyForm, status, currentUser, currentDat

# extract data from the database to populate pending form approval modal
def modal_approval_and_denial_data(formHistoryIdList):
''' This method grabs the data that populated the on approve modal for lsf'''

details_list = []
allocationWarningsByDept = {}
for fhID in formHistoryIdList:
formHistory = FormHistory.get(FormHistory.formHistoryID == fhID)
lsf = formHistory.formID
Expand All @@ -208,7 +221,8 @@ def modal_approval_and_denial_data(formHistoryIdList):
supervisorName = f"{lsf.supervisor.FIRST_NAME} {lsf.supervisor.LAST_NAME}"
weeklyHours = lsf.weeklyHours
contractHours = lsf.contractHours
deptName = lsf.department.DEPT_NAME
dept = lsf.department
deptName = dept.DEPT_NAME

if formHistory.adjustedForm:
match formHistory.adjustedForm.fieldAdjusted:
Expand All @@ -223,11 +237,17 @@ def modal_approval_and_denial_data(formHistoryIdList):
case "contractHours":
contractHours = formHistory.adjustedForm.newValue
case "department":
deptName = Department.get(Department.ORG==formHistory.adjustedForm.newValue).DEPT_NAME
dept = Department.get(Department.ORG==formHistory.adjustedForm.newValue)
deptName = dept.DEPT_NAME

details_list.append([studentName, deptName, position, str(weeklyHours),str(contractHours), supervisorName])

return details_list
if dept.departmentID not in allocationWarningsByDept:
warning = getAllocationWarning(dept, g.openTerm)
if warning:
allocationWarningsByDept[dept.departmentID] = warning

return {"details": details_list, "allocationWarnings": list(allocationWarningsByDept.values())}


def financialAidSAASOverloadApproval(historyForm, rsp, status, currentUser, currentDate):
Expand Down
123 changes: 123 additions & 0 deletions app/logic/allocation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
from peewee import fn
from app.models.allocation import Allocation
from app.models.laborStatusForm import LaborStatusForm
from app.models.formHistory import FormHistory
from app.models.term import Term

# Each entry is (Allocation field name, LaborStatusForm.jobType, LaborStatusForm.weeklyHours)
ALLOCATION_BAND_FIELDS = [
('primary_10', 'Primary', 10),
('primary_12', 'Primary', 12),
('primary_15', 'Primary', 15),
('primary_20', 'Primary', 20),
('secondary_5', 'Secondary', 5),
('secondary_10', 'Secondary', 10),
]

BAND_LABELS = {fieldName: f"{hours} Hour {jobType}" for fieldName, jobType, hours in ALLOCATION_BAND_FIELDS}


def getAllocationSummary(dept, term):
summary = {
'allocation': None,
'allocationBands': None,
'totalPositionsAllocated': None,
'totalPositionsUsed': None,
'breakHoursUsed': None,
}

if not (dept and term):
return summary

allocation = Allocation.get_or_none(Allocation.department == dept, Allocation.termCode == term)
summary['allocation'] = allocation
if not allocation:
return summary

allocationBands = {}
for fieldName, jobType, hours in ALLOCATION_BAND_FIELDS:
used = (LaborStatusForm
.select()
.join(FormHistory, on=(FormHistory.formID == LaborStatusForm.laborStatusFormID))
.where(LaborStatusForm.department == dept,
LaborStatusForm.termCode == term,
LaborStatusForm.jobType == jobType,
LaborStatusForm.weeklyHours == hours,
FormHistory.historyType == "Labor Status Form",
~(FormHistory.status % "Denied%"))
.distinct()
.count())
allocationBands[fieldName] = {'used': used, 'allocated': getattr(allocation, fieldName)}

summary['allocationBands'] = allocationBands
summary['totalPositionsAllocated'] = sum(band['allocated'] for band in allocationBands.values())
summary['totalPositionsUsed'] = sum(band['used'] for band in allocationBands.values())

# Break hours are tracked on separate break-term rows (e.g. Thanksgiving Break)
# that share the same academic year prefix as the given AY term.
yearPrefix = str(term.termCode)[:-2]
breakTermCodes = [t.termCode for t in Term.select().where(Term.isBreak == True)
if str(t.termCode).startswith(yearPrefix)]
summary['breakHoursUsed'] = (LaborStatusForm
.select(fn.SUM(LaborStatusForm.contractHours))
.join(FormHistory, on=(FormHistory.formID == LaborStatusForm.laborStatusFormID))
.where(LaborStatusForm.department == dept,
LaborStatusForm.termCode.in_(breakTermCodes),
FormHistory.historyType == "Labor Status Form",
~(FormHistory.status % "Denied%"))
.scalar()) or 0

return summary


def getBandAllocationStatus(dept, term, jobType, hours):
fieldName = next((f for f, j, h in ALLOCATION_BAND_FIELDS if j == jobType and h == hours), None)
if not fieldName:
return None

summary = getAllocationSummary(dept, term)
if not summary['allocationBands']:
return None

band = summary['allocationBands'][fieldName]
return {
'label': BAND_LABELS[fieldName],
'used': band['used'],
'allocated': band['allocated'],
'remaining': band['allocated'] - band['used'],
'isOverAllocated': band['used'] > band['allocated'],
}


def getAllocationWarning(dept, term):
summary = getAllocationSummary(dept, term)
if not summary['allocation']:
return None

positionsRemaining = summary['totalPositionsAllocated'] - summary['totalPositionsUsed']
breakHoursRemaining = summary['allocation'].breakHours - summary['breakHoursUsed']

# A department can be within its total position count while still exceeding
# one specific hour-band (e.g. over on 10-hour Primary but under on others),
# so each band needs to be checked individually, not just the aggregate total.
overAllocatedBands = [
{'label': BAND_LABELS[fieldName], 'used': band['used'], 'allocated': band['allocated']}
for fieldName, band in summary['allocationBands'].items()
if band['used'] > band['allocated']
]
isPositionsOverAllocated = positionsRemaining < 0 or bool(overAllocatedBands)
isBreakHoursOverAllocated = breakHoursRemaining < 0

return {
'departmentName': dept.DEPT_NAME,
'totalPositionsAllocated': summary['totalPositionsAllocated'],
'totalPositionsUsed': summary['totalPositionsUsed'],
'positionsRemaining': positionsRemaining,
'isPositionsOverAllocated': isPositionsOverAllocated,
'overAllocatedBands': overAllocatedBands,
'breakHoursAllocated': summary['allocation'].breakHours,
'breakHoursUsed': summary['breakHoursUsed'],
'breakHoursRemaining': breakHoursRemaining,
'isBreakHoursOverAllocated': isBreakHoursOverAllocated,
'isOverAllocated': isPositionsOverAllocated or isBreakHoursOverAllocated,
}
23 changes: 23 additions & 0 deletions app/models/allocation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from app.models import *
from app.models.department import Department
from app.models.supervisor import Supervisor
from app.models.term import Term

class Allocation(baseModel):
termCode = ForeignKeyField(Term)
department = ForeignKeyField(Department)
isFinal = BooleanField(default=False)
approvedOn = DateField(null=True)
approvedBy = ForeignKeyField(Supervisor, null=True)
justification = TextField()
primary_10 = IntegerField()
primary_12 = IntegerField()
primary_15 = IntegerField()
primary_20 = IntegerField()
secondary_5 = IntegerField()
secondary_10 = IntegerField()
breakHours = IntegerField()

class Meta:
indexes = ( (('termCode', 'department', 'isFinal'), True), )

13 changes: 13 additions & 0 deletions app/models/positionHistory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from app.models import *
from app.models.department import Department

class PositionHistory(baseModel):
positionCode = CharField()
department = ForeignKeyField(Department)
status = CharField()
wls = IntegerField()
revisionDate = DateField()
description = TextField(default=None)

class Meta:
indexes = ( (('positionCode', 'revisionDate', 'status'), True), )
1 change: 1 addition & 0 deletions app/models/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Supervisor(baseModel):
legal_name = CharField(null=True)
preferred_name = CharField(null=True)
isActive = BooleanField(default=False)
isBanned = BooleanField(default=False)


@property
Expand Down
Loading