diff --git a/app/logic/transcript.py b/app/logic/transcript.py index 74f986ab0..e474bfbbd 100644 --- a/app/logic/transcript.py +++ b/app/logic/transcript.py @@ -20,7 +20,8 @@ def getProgramTranscript(username): EventData = (Event.select(Event, fn.SUM(EventParticipant.hoursEarned).alias("hoursEarned")) .join(EventParticipant) - .where((EventParticipant.user == username) & (Event.deletionDate == None)) + .where((EventParticipant.user == username) & (Event.deletionDate == None) + & (Event.isService == True) & (Event.isCanceled == False) & (Event.isTraining == False)) .group_by(Event.program, Event.term) .order_by(Event.term) .having(fn.SUM(EventParticipant.hoursEarned > 0))) diff --git a/app/logic/volunteerSpreadsheet.py b/app/logic/volunteerSpreadsheet.py index 99bda3c35..3db5c26a9 100644 --- a/app/logic/volunteerSpreadsheet.py +++ b/app/logic/volunteerSpreadsheet.py @@ -38,7 +38,8 @@ def totalVolunteerHours(academicYear): query = (EventParticipant.select(fn.SUM(EventParticipant.hoursEarned)) .join(Event, on=(EventParticipant.event == Event.id)) .join(Term, on=(Event.term == Term.id)) - .where(Term.academicYear == academicYear) + .where((Term.academicYear == academicYear) & (Event.deletionDate == None) + & (Event.isService == True) & (Event.isCanceled == False) & (Event.isTraining == False)) ) return query.tuples() @@ -49,7 +50,8 @@ def volunteerProgramHours(academicYear): .join(Event, on=(EventParticipant.event_id == Event.id)) .join(Program, on=(Event.program_id == Program.id)) .join(Term, on=(Event.term == Term.id)) - .where(Term.academicYear == academicYear) + .where((Term.academicYear == academicYear) & (Event.deletionDate == None) + & (Event.isService == True) & (Event.isCanceled == False) & (Event.isTraining == False)) .group_by(Program.programName, EventParticipant.user_id)) return volunteerProgramHours.tuples()