From 12725243d42045b3d8f8ac1578162df8ae2f6808 Mon Sep 17 00:00:00 2001 From: bakobagassas Date: Mon, 30 Mar 2026 14:38:49 -0400 Subject: [PATCH 1/7] New function to get zero hours events --- app/logic/transcript.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/logic/transcript.py b/app/logic/transcript.py index dcbfbd3b7..04a67c749 100644 --- a/app/logic/transcript.py +++ b/app/logic/transcript.py @@ -42,6 +42,24 @@ def getProgramTranscript(username): return dict(transcriptData) +def getZeroHourEvents(username): + """ + Returns a list of events with zero hours earned for the given user, + excluding deleted and canceled events. + """ + zeroHourEvents = (Event.select(Event, Program, Term) + .join(EventParticipant) + .switch(Event) + .join(Program) + .switch(Event) + .join(Term) + .where(EventParticipant.user == username, + EventParticipant.hoursEarned == 0, + Event.deletionDate == None, + Event.isCanceled == False)) + + return list(zeroHourEvents) + def getSlCourseTranscript(username): """ Returns a SLCourse query object containing all the training events for From 90a054aaee636ec0e0e01d8571033812de571cf8 Mon Sep 17 00:00:00 2001 From: bakobagassas Date: Mon, 30 Mar 2026 15:06:45 -0400 Subject: [PATCH 2/7] adding the new get to the routes --- app/controllers/main/routes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/main/routes.py b/app/controllers/main/routes.py index 688f2434a..6f83f32dd 100644 --- a/app/controllers/main/routes.py +++ b/app/controllers/main/routes.py @@ -546,9 +546,11 @@ def serviceTranscript(username): slCourses = getSlCourseTranscript(username) totalHours = getTotalHours(username) allEventTranscript = getProgramTranscript(username) + zeroHourEvents = getZeroHourEvents(username) startDate = getStartYear(username) return render_template('main/serviceTranscript.html', allEventTranscript = allEventTranscript, + zeroHourEvents = zeroHourEvents, slCourses = slCourses.objects(), totalHours = totalHours, startDate = startDate, From 0aa3aacb38806c25c568538a0b2b25cf8e07e5ee Mon Sep 17 00:00:00 2001 From: bakobagassas Date: Mon, 30 Mar 2026 15:14:56 -0400 Subject: [PATCH 3/7] front-end display for the events with 0 hours --- app/templates/main/serviceTranscript.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/templates/main/serviceTranscript.html b/app/templates/main/serviceTranscript.html index f30af37b4..8ebf29f25 100644 --- a/app/templates/main/serviceTranscript.html +++ b/app/templates/main/serviceTranscript.html @@ -109,6 +109,29 @@
{{ programTitle }}
{% endif %} {% endfor %} + + {% if zeroHourEvents %} + {% set ns = namespace(filtered=[]) %} + {% for event in zeroHourEvents %} + {% if event.program.programName != "Bonner Scholars" %} + {% set _ = ns.filtered.append(event) %} + {% endif %} + {% endfor %} + + {% if ns.filtered %} +
+
Events with No Hours Earned
+ {% for event in ns.filtered %} +
+ + {{ event.term.description }} — {{ event.name }} - 0 hour(s) + +
+ {% endfor %} +
+ {% endif %} + {% endif %} + {% else %}
No Volunteer Record
From 4962d62c0cf786a8036a381689b8dbd4d89f646e Mon Sep 17 00:00:00 2001 From: bakobagassas Date: Mon, 30 Mar 2026 15:24:36 -0400 Subject: [PATCH 4/7] added description --- app/templates/main/serviceTranscript.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/templates/main/serviceTranscript.html b/app/templates/main/serviceTranscript.html index 8ebf29f25..b3170a210 100644 --- a/app/templates/main/serviceTranscript.html +++ b/app/templates/main/serviceTranscript.html @@ -126,6 +126,10 @@
Events with No Hours Earned
{{ event.term.description }} — {{ event.name }} - 0 hour(s) + {% if event.program.programName != "CELTS Sponsored Events" %} +

{{ event.program.description }}

+ More Information + {% endif %}
{% endfor %} From 7ebb951132a2837d53114e08dbdc1e5316318e0f Mon Sep 17 00:00:00 2001 From: bakobagassas Date: Tue, 31 Mar 2026 15:20:26 -0400 Subject: [PATCH 5/7] testing the new function --- tests/code/test_transcripts.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/code/test_transcripts.py b/tests/code/test_transcripts.py index 4fb30f09b..48d6028af 100644 --- a/tests/code/test_transcripts.py +++ b/tests/code/test_transcripts.py @@ -178,6 +178,39 @@ def testingProgram(): emptyProgramDict = getProgramTranscript(adminName) assert not emptyProgramDict +@pytest.mark.integration +def testingZeroHourEvents(): + username = "namet" + adminName = "ramsayb2" + + with mainDB.atomic() as transaction: + zeroHourEvent = Event.create(name = "Test Zero Hour Event", + term = 1, + description = "Event for testing zero hours", + timeStart = "18:00:00", + timeEnd = "21:00:00", + location = "The testing lab", + isRsvpRequired = 0, + isPrerequisiteForProgram = 0, + isTraining = 0, + isService = 0, + startDate = "2021-12-12", + recurringId = None, + program = 9) + + EventParticipant.create(user = username, + event = zeroHourEvent, + attended = True, + hoursEarned = 0) + + zeroHourEvents = getZeroHourEvents(username) + emptyZeroHourEvents = getZeroHourEvents(adminName) + + assert emptyZeroHourEvents == [] + assert zeroHourEvent in zeroHourEvents + + transaction.rollback() + @pytest.mark.integration def testingTotalHours(): From 48817d4574be6ccfb4f033bfd18e45c8de641c5c Mon Sep 17 00:00:00 2001 From: bakobagassas Date: Thu, 2 Apr 2026 15:45:48 -0400 Subject: [PATCH 6/7] removed the plural --- app/templates/main/serviceTranscript.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/main/serviceTranscript.html b/app/templates/main/serviceTranscript.html index b3170a210..5631f32b0 100644 --- a/app/templates/main/serviceTranscript.html +++ b/app/templates/main/serviceTranscript.html @@ -124,7 +124,7 @@
Events with No Hours Earned
{% for event in ns.filtered %}
- {{ event.term.description }} — {{ event.name }} - 0 hour(s) + {{ event.term.description }} — {{ event.name }} - 0 hour {% if event.program.programName != "CELTS Sponsored Events" %}

{{ event.program.description }}

From e3f3f9659e2645d677e4e332eac8322e1097acec Mon Sep 17 00:00:00 2001 From: bakobagassas Date: Thu, 2 Apr 2026 17:06:46 -0400 Subject: [PATCH 7/7] changed the display order --- app/logic/transcript.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/logic/transcript.py b/app/logic/transcript.py index 04a67c749..4e09757c7 100644 --- a/app/logic/transcript.py +++ b/app/logic/transcript.py @@ -56,7 +56,8 @@ def getZeroHourEvents(username): .where(EventParticipant.user == username, EventParticipant.hoursEarned == 0, Event.deletionDate == None, - Event.isCanceled == False)) + Event.isCanceled == False) + .order_by(Event.term)) return list(zeroHourEvents)