Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5905549
added the function laborAttendanceByTerm
Arohasina Feb 25, 2026
97fe183
added test function test_laborAttendanceByTerm
Arohasina Feb 25, 2026
4c89d93
added laborAttendanceByTerm to the spreadsheet
Arohasina Feb 25, 2026
be0b9af
removed print statements
Arohasina Feb 26, 2026
eeb4674
removed commented code
Arohasina Feb 26, 2026
07e2ded
Update app/logic/volunteerSpreadsheet.py
Arohasina Feb 26, 2026
ee86729
Update app/logic/volunteerSpreadsheet.py
Arohasina Feb 26, 2026
c9119da
Merge branch 'development' of https://github.com/BCStudentSoftwareDev…
JohnCox2211 Feb 26, 2026
6209cba
removed redundant event and reused existing ones
Arohasina Feb 26, 2026
d68bda6
Merge branch 'Labor_Attendance_report_1626' of github.com:BCStudentSo…
Arohasina Feb 26, 2026
4a863e3
added distinct
Arohasina Feb 26, 2026
7652303
Merge remote-tracking branch 'origin' into Labor_Attendance_report_1626
Arohasina Mar 10, 2026
d37e2ae
include all labor students even with zero attendance and non-labor at…
Arohasina Mar 18, 2026
7936d62
added the return
Arohasina Mar 18, 2026
86fd8c6
Merge remote-tracking branch 'origin' into Labor_Attendance_report_1626
Arohasina Mar 18, 2026
4354374
switched FULL JOIN to Union to fix SQL syntax bug
Arohasina Mar 18, 2026
85cedd3
Merge remote-tracking branch 'origin' into Labor_Attendance_report_1626
Arohasina Mar 24, 2026
240e802
Split labor attendance report into separate sheets by term and fix bl…
Arohasina Mar 24, 2026
5cd4859
for laborQuery changed EventParticipant.event_id to Event.id to fix c…
Arohasina Mar 24, 2026
ef2e93d
removed redundant
Arohasina Mar 25, 2026
80081a2
fix filter term
Arohasina Mar 26, 2026
f9749ff
fix test
Arohasina Mar 26, 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
22 changes: 22 additions & 0 deletions app/logic/volunteerSpreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,27 @@ def calculateRetentionRate(fallDict, springDict):

return retentionDict

def laborAttendanceByTerm(academicYear):
"""Get labor students and their meeting attendance count for each term"""
base = getBaseQuery(academicYear)

query = (base.select(
fn.CONCAT(User.firstName, ' ', User.lastName).alias('fullName'),
User.bnumber,
fn.CONCAT(EventParticipant.user_id, '@berea.edu').alias('email'),
Term.description,
fn.COUNT(EventParticipant.event_id).alias('meetingsAttended'),
)
.where(Event.isLaborOnly == True)
.group_by(EventParticipant.user_id, Term.description)
.order_by(User.lastName, User.firstName, Term.description)
)

columns = ("Full Name", "B-Number", "Email", "Term", "Meetings Attended")
results = list(query.tuples())
return (columns, results)



def makeDataXls(sheetName, sheetData, workbook, sheetDesc=None):
# assumes the length of the column titles matches the length of the data
Expand Down Expand Up @@ -271,6 +292,7 @@ def createSpreadsheet(academicYear):
makeDataXls("Unique Volunteers", getUniqueVolunteers(academicYear), workbook, sheetDesc=f"All students who participated in at least one service event during {academicYear}.")
makeDataXls("Only All Volunteer Training", onlyCompletedAllVolunteer(academicYear), workbook, sheetDesc="Students who participated in an All Volunteer Training, but did not participate in any service events.")
makeDataXls("Retention Rate By Semester", getRetentionRate(academicYear), workbook, sheetDesc="The percentage of students who participated in service events in the fall semester who also participated in a service event in the spring semester. Does not currently account for fall graduations.")
makeDataXls("Labor Attendance By Term", laborAttendanceByTerm(academicYear), workbook, sheetDesc="Labor students and the number of labor meetings attended for each term in the academic year.")

fallTerm = getFallTerm(academicYear)
springTerm = getSpringTerm(academicYear)
Expand Down
16 changes: 14 additions & 2 deletions tests/code/test_spreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def fixture_info():
startDate=date(2023, 9, 1),
isCanceled=False,
deletionDate=None,
isService=True
isService=True,
isLaborOnly=True
)
event2 = Event.create(
name='Event2',
Expand All @@ -41,7 +42,8 @@ def fixture_info():
startDate=date(2023, 9, 10),
isCanceled=False,
deletionDate=None,
isService=True
isService=True,
isLaborOnly=True
)
event3 = Event.create(
name='Event3',
Expand Down Expand Up @@ -683,5 +685,15 @@ def test_getUniqueVolunteers(fixture_info):
("Test Tester", "testt@berea.edu", "B55555"),
])

@pytest.mark.integration
def test_laborAttendanceByTerm(fixture_info):
EventParticipant.create(event=fixture_info["event1"], user=fixture_info['user1'], hoursEarned=1)
EventParticipant.create(event=fixture_info["event2"], user=fixture_info['user1'], hoursEarned=1)
EventParticipant.create(event=fixture_info["event1"], user=fixture_info['user2'], hoursEarned=1)

columns, results = laborAttendanceByTerm("2023-2024-test")
assert columns == ("Full Name", "B-Number", "Email", "Term", "Meetings Attended")

assert len(results) == 2
assert ("John Doe", "B774377", "doej@berea.edu", "Fall 2023", 3) in results
assert ("Jane Doe", "B888828", "doej2@berea.edu", "Fall 2023", 2) in results