From a242c2afe54c2bc3456bd1f734be020a3c12ab7c Mon Sep 17 00:00:00 2001 From: Karina Date: Thu, 26 Feb 2026 17:15:21 -0500 Subject: [PATCH 1/4] Removed labor meetings from participation history and added labor meetings into reports spreadsheet --- app/logic/events.py | 15 +++++++-- app/logic/volunteerSpreadsheet.py | 51 +++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/app/logic/events.py b/app/logic/events.py index 05c694719..496a8127b 100644 --- a/app/logic/events.py +++ b/app/logic/events.py @@ -364,6 +364,16 @@ def getUpcomingEventsForUser(user, asOf=datetime.now(), program=None): return eventsList +def excludeLaborMeeting(): + eventName = fn.LOWER(Event.name) + eventDescription = fn.LOWER(Event.description) + + return ( + eventName.contains("labor meeting") | + eventName.contains("celts labor meeting") | + eventDescription.contains("labor meeting") + ) + def getParticipatedEventsForUser(user): """ Get all the events a user has participated in. @@ -373,17 +383,18 @@ def getParticipatedEventsForUser(user): :return: A list of Event objects """ + excLaborMeeting = excludeLaborMeeting() participatedEvents = (Event.select(Event, Program.programName) .join(Program, JOIN.LEFT_OUTER).switch() .join(EventParticipant) .where(EventParticipant.user == user, - Event.isAllVolunteerTraining == False, Event.deletionDate == None) + Event.isAllVolunteerTraining == False, Event.deletionDate == None, ~((Event.isLaborOnly == True) & excLaborMeeting), ~((Event.isTraining == True) & excLaborMeeting)) .order_by(Event.startDate, Event.name)) allVolunteer = (Event.select(Event, "") .join(EventParticipant) .where(Event.isAllVolunteerTraining == True, - EventParticipant.user == user)) + EventParticipant.user == user, ~((Event.isLaborOnly == True) & excLaborMeeting), ~((Event.isTraining == True) & excLaborMeeting))) union = participatedEvents.union_all(allVolunteer) unionParticipationWithVolunteer = list(union.select_from(union.c.id, union.c.programName, union.c.startDate, union.c.name).order_by(union.c.startDate, union.c.name).execute()) diff --git a/app/logic/volunteerSpreadsheet.py b/app/logic/volunteerSpreadsheet.py index 255cbc97b..4ff16c491 100644 --- a/app/logic/volunteerSpreadsheet.py +++ b/app/logic/volunteerSpreadsheet.py @@ -225,6 +225,56 @@ def calculateRetentionRate(fallDict, springDict): return retentionDict +def getLaborMeetingAttendance(academicYear, toDateOnly=True): + """ + This sheet tracks labor students attendance of labor meetings during academic year + """ + columns = [ + "Student First Name", + "Student Last Name", + "Student Email", + "Student B-Number", + "Program Name", + "Event Name", + "Term", + "Event Date", + ] + + laborMeeting = ( + fn.LOWER(Event.name).contains("labor meeting") | + fn.LOWER(fn.COALESCE(Event.description, "")).contains("labor meeting") + ) + + query = (EventParticipant + .select( + User.firstName, + User.lastName, + fn.CONCAT(User.username, '@berea.edu').alias("email"), + User.bnumber, + Program.programName, + Event.name, + Term.description.alias("termDesc"), + Event.startDate, + ) + .join(User) + .switch(EventParticipant) + .join(Event) + .join(Program, JOIN.LEFT_OUTER) + .switch(Event) + .join(Term) + .where( + Term.academicYear == academicYear, + Event.deletionDate == None, + Event.isCanceled == False, + Event.isLaborOnly == True, + laborMeeting, + ) + .order_by(Term.termOrder, Event.startDate, Event.name, User.lastName, User.firstName)) + + if toDateOnly: + query = query.where(Event.startDate <= date.today()) + + return (columns, query.tuples()) def makeDataXls(sheetName, sheetData, workbook, sheetDesc=None): # assumes the length of the column titles matches the length of the data @@ -271,6 +321,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 Meetings", getLaborMeetingAttendance(academicYear, toDateOnly=True), workbook, sheetDesc=f"Attendees for labor meetings during {academicYear}.") fallTerm = getFallTerm(academicYear) springTerm = getSpringTerm(academicYear) From 6652f86bb4ad793dc7e1e90357ba7989006774f6 Mon Sep 17 00:00:00 2001 From: Karina Date: Fri, 27 Feb 2026 08:39:51 -0500 Subject: [PATCH 2/4] Removed Reports attendance because Aro already made a pr for it --- app/logic/volunteerSpreadsheet.py | 52 ------------------------------- 1 file changed, 52 deletions(-) diff --git a/app/logic/volunteerSpreadsheet.py b/app/logic/volunteerSpreadsheet.py index 4ff16c491..8bbada14a 100644 --- a/app/logic/volunteerSpreadsheet.py +++ b/app/logic/volunteerSpreadsheet.py @@ -225,57 +225,6 @@ def calculateRetentionRate(fallDict, springDict): return retentionDict -def getLaborMeetingAttendance(academicYear, toDateOnly=True): - """ - This sheet tracks labor students attendance of labor meetings during academic year - """ - columns = [ - "Student First Name", - "Student Last Name", - "Student Email", - "Student B-Number", - "Program Name", - "Event Name", - "Term", - "Event Date", - ] - - laborMeeting = ( - fn.LOWER(Event.name).contains("labor meeting") | - fn.LOWER(fn.COALESCE(Event.description, "")).contains("labor meeting") - ) - - query = (EventParticipant - .select( - User.firstName, - User.lastName, - fn.CONCAT(User.username, '@berea.edu').alias("email"), - User.bnumber, - Program.programName, - Event.name, - Term.description.alias("termDesc"), - Event.startDate, - ) - .join(User) - .switch(EventParticipant) - .join(Event) - .join(Program, JOIN.LEFT_OUTER) - .switch(Event) - .join(Term) - .where( - Term.academicYear == academicYear, - Event.deletionDate == None, - Event.isCanceled == False, - Event.isLaborOnly == True, - laborMeeting, - ) - .order_by(Term.termOrder, Event.startDate, Event.name, User.lastName, User.firstName)) - - if toDateOnly: - query = query.where(Event.startDate <= date.today()) - - return (columns, query.tuples()) - def makeDataXls(sheetName, sheetData, workbook, sheetDesc=None): # assumes the length of the column titles matches the length of the data (columnTitles, dataTuples) = sheetData @@ -321,7 +270,6 @@ 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 Meetings", getLaborMeetingAttendance(academicYear, toDateOnly=True), workbook, sheetDesc=f"Attendees for labor meetings during {academicYear}.") fallTerm = getFallTerm(academicYear) springTerm = getSpringTerm(academicYear) From 82291ae023c8c401962e62129d706b04b495ae92 Mon Sep 17 00:00:00 2001 From: Karina Date: Wed, 11 Mar 2026 10:57:41 -0400 Subject: [PATCH 3/4] Fixed comments --- app/logic/events.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/app/logic/events.py b/app/logic/events.py index 496a8127b..1a2c28e67 100644 --- a/app/logic/events.py +++ b/app/logic/events.py @@ -364,16 +364,6 @@ def getUpcomingEventsForUser(user, asOf=datetime.now(), program=None): return eventsList -def excludeLaborMeeting(): - eventName = fn.LOWER(Event.name) - eventDescription = fn.LOWER(Event.description) - - return ( - eventName.contains("labor meeting") | - eventName.contains("celts labor meeting") | - eventDescription.contains("labor meeting") - ) - def getParticipatedEventsForUser(user): """ Get all the events a user has participated in. @@ -383,18 +373,20 @@ def getParticipatedEventsForUser(user): :return: A list of Event objects """ - excLaborMeeting = excludeLaborMeeting() + eventName = fn.LOWER(Event.name) + checkIfLaborMeeting = eventName.contains("labor meeting") + participatedEvents = (Event.select(Event, Program.programName) .join(Program, JOIN.LEFT_OUTER).switch() .join(EventParticipant) .where(EventParticipant.user == user, - Event.isAllVolunteerTraining == False, Event.deletionDate == None, ~((Event.isLaborOnly == True) & excLaborMeeting), ~((Event.isTraining == True) & excLaborMeeting)) + Event.isAllVolunteerTraining == False, Event.deletionDate == None, checkIfLaborMeeting) .order_by(Event.startDate, Event.name)) allVolunteer = (Event.select(Event, "") .join(EventParticipant) .where(Event.isAllVolunteerTraining == True, - EventParticipant.user == user, ~((Event.isLaborOnly == True) & excLaborMeeting), ~((Event.isTraining == True) & excLaborMeeting))) + EventParticipant.user == user)) union = participatedEvents.union_all(allVolunteer) unionParticipationWithVolunteer = list(union.select_from(union.c.id, union.c.programName, union.c.startDate, union.c.name).order_by(union.c.startDate, union.c.name).execute()) From 41615f8c33e654c660cd229d7abe7548c3867540 Mon Sep 17 00:00:00 2001 From: Karina Date: Thu, 12 Mar 2026 16:43:42 -0400 Subject: [PATCH 4/4] Fixed issue with not letting labor meeting into participation history --- app/logic/events.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/logic/events.py b/app/logic/events.py index 1a2c28e67..22dfe2719 100644 --- a/app/logic/events.py +++ b/app/logic/events.py @@ -380,7 +380,7 @@ def getParticipatedEventsForUser(user): .join(Program, JOIN.LEFT_OUTER).switch() .join(EventParticipant) .where(EventParticipant.user == user, - Event.isAllVolunteerTraining == False, Event.deletionDate == None, checkIfLaborMeeting) + Event.isAllVolunteerTraining == False, Event.deletionDate == None, ~checkIfLaborMeeting) .order_by(Event.startDate, Event.name)) allVolunteer = (Event.select(Event, "")