From a52eeca52cd0be83ba5faddc7629f77b3717bab5 Mon Sep 17 00:00:00 2001 From: Brian Ramsay Date: Thu, 2 Jul 2026 11:56:23 -0400 Subject: [PATCH 01/15] Add base for department portal --- app/controllers/main_routes/main_routes.py | 24 ++++++- app/static/css/base.css | 73 ++++++++++++++++++++++ app/static/js/departmentPortal.js | 6 ++ app/templates/main/departmentPortal.html | 27 ++++++++ app/templates/sidebar.html | 15 +++-- 5 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 app/static/js/departmentPortal.js create mode 100644 app/templates/main/departmentPortal.html diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index b3af06c9e..0a2f21e4b 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -1,5 +1,5 @@ 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 @@ -47,6 +47,26 @@ def supervisorPortal(): currentUser = currentUser ) +@main_bp.route('/department', methods=['GET']) +@main_bp.route('/department/', methods=['GET']) +@main_bp.route('/department//', methods=['GET']) +def departmentPortal(org=None,account=None): + try: + dept = Department.get(Department.ORG == org, Department.ACCOUNT == account) + except (NameError, DoesNotExist): + 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())) + + return render_template('main/departmentPortal.html', + departments = departments, + department = dept) + @main_bp.route('/supervisorPortal/addUserToDept', methods=['GET', 'POST']) def addUserToDept(): userDeptData = request.form @@ -113,4 +133,4 @@ def submitToBanner(formHistoryId): if save_form_status: return "Form successfully submitted to Banner.", 200 else: - return "Submitting to Banner failed.", 500 \ No newline at end of file + return "Submitting to Banner failed.", 500 diff --git a/app/static/css/base.css b/app/static/css/base.css index 916fb4db9..940f8d6e5 100755 --- a/app/static/css/base.css +++ b/app/static/css/base.css @@ -191,3 +191,76 @@ a { font-size:1.2em; z-index:999; } + +.card { + position: relative; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + min-width: 0; + word-wrap: break-word; + background-color: #fff; + background-clip: border-box; + border: 1px solid rgba(0, 0, 0, 0.125); + border-radius: 0.25rem; +} + +.card-body { + -webkit-box-flex: 1; + -ms-flex: 1 1 auto; + flex: 1 1 auto; + padding: 1rem 1rem; +} + +.card-title { + margin-bottom: 0.5rem; + font-size: 1.25rem; + font-weight: 500; +} + +.card-subtitle { + margin-top: -0.25rem; + margin-bottom: 0; +} + +.card-text:last-child { + margin-bottom: 0; +} + +.card-link + .card-link { + margin-left: 1rem; +} + +.card-header { + padding: 0.5rem 1rem; + margin-bottom: 0; + background-color: rgba(0, 0, 0, 0.03); + border-bottom: 1px solid rgba(0, 0, 0, 0.125); +} + +.card-header:first-child { + border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0; +} + +.card-footer { + padding: 0.5rem 1rem; + background-color: rgba(0, 0, 0, 0.03); + border-top: 1px solid rgba(0, 0, 0, 0.125); +} + +.card-footer:last-child { + border-radius: 0 0 calc(0.25rem - 1px) calc(0.25rem - 1px); +} + +.card-img, .card-img-top { + width: 100%; +} + +.card-img-top { + border-top-left-radius: calc(0.25rem - 1px); + border-top-right-radius: calc(0.25rem - 1px); +} diff --git a/app/static/js/departmentPortal.js b/app/static/js/departmentPortal.js new file mode 100644 index 000000000..cb2023a3a --- /dev/null +++ b/app/static/js/departmentPortal.js @@ -0,0 +1,6 @@ +$(document).ready(function() { + $("#selectedDepartment").on("change",function() { + deptData = $(this).find('option:selected').data(); + window.location = `/department/${deptData.org}/${deptData.account}`; + }); +}); diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html new file mode 100644 index 000000000..8ee01838b --- /dev/null +++ b/app/templates/main/departmentPortal.html @@ -0,0 +1,27 @@ +{% extends "base.html" %} + +{% block scripts %} +{{super()}} + +{% endblock %} + +{% block app_content %} +

{% if department %} {{department.DEPT_NAME}} Portal {% else %} Choose a Department: {% endif %}

+ + +
+ + +
+{% endblock %} diff --git a/app/templates/sidebar.html b/app/templates/sidebar.html index 323b6b03b..1486f7de2 100644 --- a/app/templates/sidebar.html +++ b/app/templates/sidebar.html @@ -49,17 +49,24 @@

Labor History

{% if currentUser.supervisor %}
+ {% endif %} {% if currentUser.supervisor or (currentUser.student and currentUser.isLaborAdmin) %}
- -
+ +

New Labor Status Form

@@ -67,7 +74,7 @@

New Labor Status Form

{% endif %} {% if currentUser.supervisor or (currentUser.student and currentUser.isLaborAdmin) %}
-
+

Department Portal

From 7c1adec948ec65c3f8251214bdff90de9877b59b Mon Sep 17 00:00:00 2001 From: BhushanSah Date: Thu, 2 Jul 2026 21:04:00 +0000 Subject: [PATCH 03/15] Added member card --- app/static/css/base.css | 32 ++++++++++ app/templates/main/departmentPortal.html | 80 ++++++++++++++++++++++++ 2 files changed, 112 insertions(+) diff --git a/app/static/css/base.css b/app/static/css/base.css index 940f8d6e5..9c5d8e2fb 100755 --- a/app/static/css/base.css +++ b/app/static/css/base.css @@ -264,3 +264,35 @@ a { border-top-left-radius: calc(0.25rem - 1px); border-top-right-radius: calc(0.25rem - 1px); } + + +.members-card .media { + margin-bottom: 18px; +} + +.members-card h4 { + margin-top: 18px; + margin-bottom: 4px; +} + +.members-card-icon { + display: inline-block; + width: 42px; + height: 42px; + line-height: 42px; + text-align: center; + border-radius: 50%; + background-color: #e8edf3; + color: #7c8ea1; + font-size: 18px; +} + +.members-card-cta { + position: relative; + display: inline-block; +} + +.members-card-btn { + border-radius: 20px; + padding: 8px 20px; +} diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index 8ee01838b..6238bfe07 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -3,6 +3,8 @@ {% block scripts %} {{super()}} + {% endblock %} {% block app_content %} @@ -24,4 +26,82 @@

{% if department %} {{department.DEPT_NAME}} Portal {% e

+ + +
+
+
+ +
+
+ +
+ +
+

+ Members +

+
+
+ +

Labor Coordinator

+

Dr. Jones

+ +

Supervisors

+

+ Dr. Heggen
+ Dr. Nakazawa +

+ +

+ + + View Details + + + +

+ +
+
+
{% endblock %} + + From 6bb3e689b95c263fd766bdf43b2a4c74228afb32 Mon Sep 17 00:00:00 2001 From: Dayton Conwell Date: Thu, 2 Jul 2026 21:06:38 +0000 Subject: [PATCH 04/15] some change --- app/templates/main/departmentPortal.html | 14 ++++++++++++++ app/templates/main/supervisorPortal.html | 2 +- database/reset_database.sh | 14 +++++++------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index 8ee01838b..18a6b9f64 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -8,6 +8,20 @@ {% block app_content %}

{% if department %} {{department.DEPT_NAME}} Portal {% else %} Choose a Department: {% endif %}

+
+
+
+ + + + + Current Allocation +
+


AY 26/27 15/20 POSITIONS

Break Hours 0 of 200 hrs

+ Go somewhere +
+
+
diff --git a/database/reset_database.sh b/database/reset_database.sh index 82f6cff53..ad6dbd91f 100755 --- a/database/reset_database.sh +++ b/database/reset_database.sh @@ -8,7 +8,7 @@ if [ "$1" != "test" ] && [ "$1" != "from-backup" ]; then fi cd database; - + PRODUCTION=0 if [ "`hostname`" == 'lsf.berea.edu' ]; then echo "DO NOT RUN THIS SCRIPT ON PRODUCTION UNLESS YOU REALLY REALLY KNOW WHAT YOU ARE DOING" @@ -22,12 +22,12 @@ if [ "$1" == "from-backup" ]; then fi echo "Dropping databases" -mysql -u root -proot --execute="DROP DATABASE \`lsf\`; DROP USER 'lsf_user';" -mysql -u root -proot --execute="DROP DATABASE \`UTE\`; DROP USER 'tracy_user';" +mysql -u root -proot --skip-ssl --execute="DROP DATABASE \`lsf\`; DROP USER 'lsf_user';" +mysql -u root -proot --skip-ssl --execute="DROP DATABASE \`UTE\`; DROP USER 'tracy_user';" echo "Recreating databases and users" -mysql -u root -proot --execute="CREATE DATABASE IF NOT EXISTS \`lsf\`; CREATE USER IF NOT EXISTS 'lsf_user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'lsf_user'@'%';" -mysql -u root -proot --execute="CREATE DATABASE IF NOT EXISTS \`UTE\`; CREATE USER IF NOT EXISTS 'tracy_user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'tracy_user'@'%';" +mysql -u root -proot --skip-ssl --execute="CREATE DATABASE IF NOT EXISTS \`lsf\`; CREATE USER IF NOT EXISTS 'lsf_user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'lsf_user'@'%';" +mysql -u root -proot --skip-ssl --execute="CREATE DATABASE IF NOT EXISTS \`UTE\`; CREATE USER IF NOT EXISTS 'tracy_user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'tracy_user'@'%';" cd database @@ -38,14 +38,14 @@ rm -rf migrations.json echo "Creating database objects" if [ $BACKUP -eq 1 ]; then echo " from backup" - mysql -u root -proot lsf < prod-backup.sql + mysql -u root -proot --skip-ssl lsf < prod-backup.sql else echo " empty" ./migrate_db.sh fi if [ $PRODUCTION -ne 1 ]; then - ./migrate_db_tracy.sh + ./migrate_db_tracy.sh fi rm -rf lsf_migrations From c29f01f461b8eb2a149605830f3506ea2caebde7 Mon Sep 17 00:00:00 2001 From: lolongaj Date: Thu, 2 Jul 2026 21:10:05 +0000 Subject: [PATCH 05/15] added 3 sample buttons to learn HTML --- app/templates/main/departmentPortal.html | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index 8ee01838b..73f0c783c 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -4,7 +4,6 @@ {{super()}} {% endblock %} - {% block app_content %}

{% if department %} {{department.DEPT_NAME}} Portal {% else %} Choose a Department: {% endif %}

@@ -24,4 +23,23 @@

{% if department %} {{department.DEPT_NAME}} Portal {% e

-{% endblock %} +
+
+
+

Positions

+

Student Programmer

+ View Details +
+
+
+

burrh

+
+
+
+

Positions

+

Student Programmer

+ View Details +
+
+
+{% endblock %}\ \ No newline at end of file From aa3a837d23f7543684ae0275dd86681ee63a0d0b Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Fri, 3 Jul 2026 13:17:42 +0000 Subject: [PATCH 06/15] uniform sizing for cards that scale with the screen and no cards when no department is selected --- app/templates/main/departmentPortal.html | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index 73f0c783c..e31f476bf 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -23,15 +23,17 @@

{% if department %} {{department.DEPT_NAME}} Portal {% e

-
-
+ +{% if department %} +
+

Positions

-

Student Programmer

+

{{department.ACCOUNT}}

View Details
-
+

burrh

@@ -42,4 +44,9 @@

Positions

+
+

aaaaaa

+
+{% endif %} + {% endblock %}\ \ No newline at end of file From 645e85ae93f8b743030a98a3160389194530c790 Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Fri, 3 Jul 2026 15:38:25 +0000 Subject: [PATCH 07/15] added a 10 position cap to the amount of visible positons --- app/controllers/main_routes/main_routes.py | 11 +++++++++-- app/templates/main/departmentPortal.html | 22 ++++++++++++++-------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index 0a2f21e4b..18c0f3963 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -16,6 +16,7 @@ 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 @main_bp.route('/logout', methods=['GET']) def triggerLogout(): @@ -62,10 +63,16 @@ def departmentPortal(org=None,account=None): 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 = [] + for i in pos: + positions.append(i.POSN_TITLE + "" + "(" + i.WLS + ")") + print(positions) return render_template('main/departmentPortal.html', departments = departments, - department = dept) + department = dept, + positions = positions) @main_bp.route('/supervisorPortal/addUserToDept', methods=['GET', 'POST']) def addUserToDept(): diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index e31f476bf..1f3e9e422 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -23,30 +23,36 @@

{% if department %} {{department.DEPT_NAME}} Portal {% e

- + {% if department %}
-

Positions

+

that one thing

{{department.ACCOUNT}}

View Details
-
-

burrh

+
+
+

burrh

+

crazy interesting stuff here

+ View Details +

Positions

-

Student Programmer

+ {% for p in positions %} + {% if 10 > loop.index0 %} +

{{ p }}

+ {% endif %} + {% endfor %} View Details
-
-

aaaaaa

-
+ {% endif %} {% endblock %}\ \ No newline at end of file From d3c0b0401958ff6a147be8142468e92c68938acc Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Fri, 3 Jul 2026 15:40:44 +0000 Subject: [PATCH 08/15] removed an unecessary print statement from the main_routes.py --- app/controllers/main_routes/main_routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index 18c0f3963..36bd7cb05 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -68,7 +68,7 @@ def departmentPortal(org=None,account=None): positions = [] for i in pos: positions.append(i.POSN_TITLE + "" + "(" + i.WLS + ")") - print(positions) + return render_template('main/departmentPortal.html', departments = departments, department = dept, From 693191bfd9161858047801e2b8555bd58f8dc1ae Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Fri, 3 Jul 2026 20:31:48 +0000 Subject: [PATCH 09/15] got the first card added from Dayton's branch --- app/templates/main/departmentPortal.html | 32 ++++++++++-------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index 86a15e6ce..fa226dca7 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -7,19 +7,6 @@ {% block app_content %}

{% if department %} {{department.DEPT_NAME}} Portal {% else %} Choose a Department: {% endif %}

-
-
-
- - - - - Current Allocation -
-


AY 26/27 15/20 POSITIONS

Break Hours 0 of 200 hrs

- Go somewhere -
-
@@ -40,13 +27,20 @@
{% if department %}
-
-
-

that one thing

-

{{department.ACCOUNT}}

- View Details -
+ +
+
+
+ + + + + Current Allocation +
+


AY 26/27 15/20 POSITIONS

Break Hours 0 of 200 hrs

+ Go somewhere
+

burrh

From 1bb8c18f69e2779e29ba9a654b49c61d50073547 Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Fri, 3 Jul 2026 21:23:04 +0000 Subject: [PATCH 10/15] added real people into the members card, its wrong and gives us everyone --- app/controllers/main_routes/main_routes.py | 10 +++++++++- app/templates/main/departmentPortal.html | 17 +++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index 36bd7cb05..17fa6f2a2 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -69,10 +69,18 @@ def departmentPortal(org=None,account=None): for i in pos: positions.append(i.POSN_TITLE + "" + "(" + i.WLS + ")") + staff = Tracy().getSupervisors() + supervisors = [] + + for i in staff: + if i.DEPT_NAME == Department.DEPT_NAME: + supervisors.append(i.FIRST_NAME + " " + i.LAST_NAME + " (" + i.EMAIL + ")") + return render_template('main/departmentPortal.html', departments = departments, department = dept, - positions = positions) + positions = positions, + supervisors = supervisors) @main_bp.route('/supervisorPortal/addUserToDept', methods=['GET', 'POST']) def addUserToDept(): diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index a221f7160..bc3710bd7 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -45,7 +45,6 @@
-
@@ -53,22 +52,23 @@
-

Members

- -

Labor Coordinator

+

Labor Coordinator(s)

Dr. Jones

Supervisors

-

- Dr. Heggen
- Dr. Nakazawa -

+ {% for s in supervisors %} + {% if 3 > loop.index0 %} +

{{ s }}

+ {% elif 4 > loop.index0 %} +

and {{ supervisors | length}} more...

+ {% endif %} + {% endfor %}
+

Positions

From 3f6aa594d26c04ff25ded1fb935925cfa7b99e46 Mon Sep 17 00:00:00 2001 From: fritzj2 Date: Mon, 6 Jul 2026 13:17:24 +0000 Subject: [PATCH 11/15] changed the button from members to blue --- app/templates/main/departmentPortal.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index bc3710bd7..fd29a2ec3 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -53,15 +53,15 @@
-

+

Members -

+

Labor Coordinator(s)

Dr. Jones

-

Supervisors

+

Supervisors

{% for s in supervisors %} {% if 3 > loop.index0 %}

{{ s }}

@@ -72,8 +72,8 @@

Supervisors

From abcd951f493146b284bae8c55717d8c598dc0862 Mon Sep 17 00:00:00 2001 From: rukwashai Date: Mon, 6 Jul 2026 09:57:32 -0400 Subject: [PATCH 12/15] Add real data to the Current Allocation card - New Allocation model (department, term, totalPositions, totalBreakHours) - Register Allocation in migrate_db.sh - Seed demo allocation rows per department in demo_data.py - departmentPortal route now queries Allocation for the selected dept and open term, and computes positions/break-hours used from LaborStatusForm - Template renders real allocation data instead of hardcoded placeholder text --- app/controllers/main_routes/main_routes.py | 23 +++++++++++++++++++--- app/models/allocation.py | 9 +++++++++ app/templates/main/departmentPortal.html | 9 +++++++-- database/demo_data.py | 15 ++++++++++++++ database/migrate_db.sh | 1 + 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 app/models/allocation.py diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index 17fa6f2a2..3dd3fa40b 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -1,8 +1,9 @@ from flask import render_template, request, json, redirect, url_for, send_file, g, flash, jsonify -from peewee import JOIN, DoesNotExist +from peewee import JOIN, DoesNotExist, fn from functools import reduce import operator from app.models.department import Department +from app.models.allocation import Allocation from app.models.supervisor import Supervisor from app.models.supervisorDepartment import SupervisorDepartment from app.models.student import Student @@ -76,11 +77,27 @@ def departmentPortal(org=None,account=None): if i.DEPT_NAME == Department.DEPT_NAME: supervisors.append(i.FIRST_NAME + " " + i.LAST_NAME + " (" + i.EMAIL + ")") - return render_template('main/departmentPortal.html', + allocation = None + positionsUsed = 0 + breakHoursUsed = 0 + if dept and g.openTerm: + allocation = Allocation.get_or_none(Allocation.department == dept, Allocation.term == g.openTerm) + usage = (LaborStatusForm + .select(fn.COUNT(LaborStatusForm.laborStatusFormID).alias('positionCount'), + fn.SUM(LaborStatusForm.contractHours).alias('hoursSum')) + .where(LaborStatusForm.department == dept, LaborStatusForm.termCode == g.openTerm) + .get()) + positionsUsed = usage.positionCount or 0 + breakHoursUsed = usage.hoursSum or 0 + + return render_template('main/departmentPortal.html', departments = departments, department = dept, positions = positions, - supervisors = supervisors) + supervisors = supervisors, + allocation = allocation, + positionsUsed = positionsUsed, + breakHoursUsed = breakHoursUsed) @main_bp.route('/supervisorPortal/addUserToDept', methods=['GET', 'POST']) def addUserToDept(): diff --git a/app/models/allocation.py b/app/models/allocation.py new file mode 100644 index 000000000..f67b61e3e --- /dev/null +++ b/app/models/allocation.py @@ -0,0 +1,9 @@ +from app.models import * +from app.models.department import Department +from app.models.term import Term + +class Allocation(baseModel): + department = ForeignKeyField(Department, on_delete="cascade") + term = ForeignKeyField(Term, on_delete="cascade") + totalPositions = IntegerField() + totalBreakHours = IntegerField() diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index fd29a2ec3..d77f22f8e 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -39,8 +39,13 @@
Current Allocation
-


AY 26/27 15/20 POSITIONS

Break Hours 0 of 200 hrs

- Go somewhere + {% if allocation %} +


{{allocation.term.termName}} {{positionsUsed}}/{{allocation.totalPositions}} POSITIONS +

Break Hours {{breakHoursUsed}} of {{allocation.totalBreakHours}} hrs

+ {% else %} +


No allocation set for this term.

+ {% endif %} + View Details
diff --git a/database/demo_data.py b/database/demo_data.py index 0557c9361..1bb4c3b6a 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -530,6 +530,21 @@ Term.insert_many(terms).on_conflict_replace().execute() print(f" * terms for {current_year}-{current_year+1} added") +############################# +# Allocation +############################# +from app.models.allocation import Allocation + +allocations = [ + {"department": 1, "term": f"{current_year}00", "totalPositions": 20, "totalBreakHours": 200}, + {"department": 2, "term": f"{current_year}00", "totalPositions": 12, "totalBreakHours": 150}, + {"department": 3, "term": f"{current_year}00", "totalPositions": 15, "totalBreakHours": 180}, + {"department": 4, "term": f"{current_year}00", "totalPositions": 10, "totalBreakHours": 100}, + {"department": 5, "term": f"{current_year}00", "totalPositions": 20, "totalBreakHours": 200}, +] +Allocation.insert_many(allocations).on_conflict_replace().execute() +print(" * allocations added") + ############################# # Create a Pending Labor Status Form ############################# diff --git a/database/migrate_db.sh b/database/migrate_db.sh index f88c91f26..472aab283 100755 --- a/database/migrate_db.sh +++ b/database/migrate_db.sh @@ -16,6 +16,7 @@ pem add app.models.laborStatusForm.LaborStatusForm pem add app.models.laborReleaseForm.LaborReleaseForm pem add app.models.term.Term pem add app.models.department.Department +pem add app.models.allocation.Allocation pem add app.models.emailTemplate.EmailTemplate pem add app.models.formHistory.FormHistory pem add app.models.adjustedForm.AdjustedForm From cdabc2a68f6047bbc892c313cc7d4bcd004c9054 Mon Sep 17 00:00:00 2001 From: Dayton Conwell Date: Mon, 6 Jul 2026 14:14:20 +0000 Subject: [PATCH 13/15] added changes to format with all 3 cards --- app/templates/main/departmentPortal.html | 37 +++++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index bc3710bd7..78fda0498 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -30,19 +30,34 @@

{% if department %} {{department.DEPT_NAME}} Portal {% e {% if department %}
-
+
-
- - - - - Current Allocation -
-


AY 26/27 15/20 POSITIONS

Break Hours 0 of 200 hrs

- Go somewhere +
+
+ + + +
+
+

+ Current Allocation +

+
+
+

AY 26/27      15 / 20 Positions

+

Break Hours      0 of 200 Hrs.

-
+ + + +
From b75e82216bae6efda6770d2796518489633aac68 Mon Sep 17 00:00:00 2001 From: rukwashai Date: Mon, 6 Jul 2026 10:37:14 -0400 Subject: [PATCH 14/15] Revert "Add real data to the Current Allocation card" This reverts commit abcd951f493146b284bae8c55717d8c598dc0862. --- app/controllers/main_routes/main_routes.py | 23 +++------------------- app/models/allocation.py | 9 --------- app/templates/main/departmentPortal.html | 9 ++------- database/demo_data.py | 15 -------------- database/migrate_db.sh | 1 - 5 files changed, 5 insertions(+), 52 deletions(-) delete mode 100644 app/models/allocation.py diff --git a/app/controllers/main_routes/main_routes.py b/app/controllers/main_routes/main_routes.py index 3dd3fa40b..17fa6f2a2 100755 --- a/app/controllers/main_routes/main_routes.py +++ b/app/controllers/main_routes/main_routes.py @@ -1,9 +1,8 @@ from flask import render_template, request, json, redirect, url_for, send_file, g, flash, jsonify -from peewee import JOIN, DoesNotExist, fn +from peewee import JOIN, DoesNotExist from functools import reduce import operator from app.models.department import Department -from app.models.allocation import Allocation from app.models.supervisor import Supervisor from app.models.supervisorDepartment import SupervisorDepartment from app.models.student import Student @@ -77,27 +76,11 @@ def departmentPortal(org=None,account=None): if i.DEPT_NAME == Department.DEPT_NAME: supervisors.append(i.FIRST_NAME + " " + i.LAST_NAME + " (" + i.EMAIL + ")") - allocation = None - positionsUsed = 0 - breakHoursUsed = 0 - if dept and g.openTerm: - allocation = Allocation.get_or_none(Allocation.department == dept, Allocation.term == g.openTerm) - usage = (LaborStatusForm - .select(fn.COUNT(LaborStatusForm.laborStatusFormID).alias('positionCount'), - fn.SUM(LaborStatusForm.contractHours).alias('hoursSum')) - .where(LaborStatusForm.department == dept, LaborStatusForm.termCode == g.openTerm) - .get()) - positionsUsed = usage.positionCount or 0 - breakHoursUsed = usage.hoursSum or 0 - - return render_template('main/departmentPortal.html', + return render_template('main/departmentPortal.html', departments = departments, department = dept, positions = positions, - supervisors = supervisors, - allocation = allocation, - positionsUsed = positionsUsed, - breakHoursUsed = breakHoursUsed) + supervisors = supervisors) @main_bp.route('/supervisorPortal/addUserToDept', methods=['GET', 'POST']) def addUserToDept(): diff --git a/app/models/allocation.py b/app/models/allocation.py deleted file mode 100644 index f67b61e3e..000000000 --- a/app/models/allocation.py +++ /dev/null @@ -1,9 +0,0 @@ -from app.models import * -from app.models.department import Department -from app.models.term import Term - -class Allocation(baseModel): - department = ForeignKeyField(Department, on_delete="cascade") - term = ForeignKeyField(Term, on_delete="cascade") - totalPositions = IntegerField() - totalBreakHours = IntegerField() diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index d77f22f8e..fd29a2ec3 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -39,13 +39,8 @@
Current Allocation
- {% if allocation %} -


{{allocation.term.termName}} {{positionsUsed}}/{{allocation.totalPositions}} POSITIONS -

Break Hours {{breakHoursUsed}} of {{allocation.totalBreakHours}} hrs

- {% else %} -


No allocation set for this term.

- {% endif %} - View Details +


AY 26/27 15/20 POSITIONS

Break Hours 0 of 200 hrs

+ Go somewhere
diff --git a/database/demo_data.py b/database/demo_data.py index 1bb4c3b6a..0557c9361 100644 --- a/database/demo_data.py +++ b/database/demo_data.py @@ -530,21 +530,6 @@ Term.insert_many(terms).on_conflict_replace().execute() print(f" * terms for {current_year}-{current_year+1} added") -############################# -# Allocation -############################# -from app.models.allocation import Allocation - -allocations = [ - {"department": 1, "term": f"{current_year}00", "totalPositions": 20, "totalBreakHours": 200}, - {"department": 2, "term": f"{current_year}00", "totalPositions": 12, "totalBreakHours": 150}, - {"department": 3, "term": f"{current_year}00", "totalPositions": 15, "totalBreakHours": 180}, - {"department": 4, "term": f"{current_year}00", "totalPositions": 10, "totalBreakHours": 100}, - {"department": 5, "term": f"{current_year}00", "totalPositions": 20, "totalBreakHours": 200}, -] -Allocation.insert_many(allocations).on_conflict_replace().execute() -print(" * allocations added") - ############################# # Create a Pending Labor Status Form ############################# diff --git a/database/migrate_db.sh b/database/migrate_db.sh index 472aab283..f88c91f26 100755 --- a/database/migrate_db.sh +++ b/database/migrate_db.sh @@ -16,7 +16,6 @@ pem add app.models.laborStatusForm.LaborStatusForm pem add app.models.laborReleaseForm.LaborReleaseForm pem add app.models.term.Term pem add app.models.department.Department -pem add app.models.allocation.Allocation pem add app.models.emailTemplate.EmailTemplate pem add app.models.formHistory.FormHistory pem add app.models.adjustedForm.AdjustedForm From f5b49768da8cacefa7dd2d72d6dc7ecf742cca62 Mon Sep 17 00:00:00 2001 From: Dayton Conwell Date: Mon, 6 Jul 2026 15:48:02 +0000 Subject: [PATCH 15/15] began formatting allocation card for pull request draft --- app/templates/main/departmentPortal.html | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/templates/main/departmentPortal.html b/app/templates/main/departmentPortal.html index e4dc9804e..94f1c46b2 100644 --- a/app/templates/main/departmentPortal.html +++ b/app/templates/main/departmentPortal.html @@ -35,17 +35,26 @@

{% if department %} {{department.DEPT_NAME}} Portal {% e
- +

+ Current Allocation +

-
-

- Current Allocation -

+
+
+
+

AY 26/27

15/20 Positions

+
    +
  • 10 HR : 2
  • +
  • 12 HR : 3
  • +
  • 15 HR : 5
  • +
  • 20 HR : 5
  • +
+
+
+

Break Hours

0 of 200 Hrs.

-

AY 26/27      15 / 20 Positions

-

Break Hours      0 of 200 Hrs.