Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
15 changes: 13 additions & 2 deletions app/logic/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,16 @@ def getUpcomingEventsForUser(user, asOf=datetime.now(), program=None):

return eventsList

def excludeLaborMeeting():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function makes a clause that determines if the event IS a labor meeting, but is called excludeLaborMeeting

eventName = fn.LOWER(Event.name)
eventDescription = fn.LOWER(Event.description)

return (
eventName.contains("labor meeting") |
eventName.contains("celts labor meeting") |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant, because this would be caught be the first check.

eventDescription.contains("labor meeting")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could potentially catch too much. Let's not check event description.

)

def getParticipatedEventsForUser(user):
"""
Get all the events a user has participated in.
Expand All @@ -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))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify this by just excluding Labor Meetings. There aren't going to be other labor meetings that we want to put in this list.

.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)))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Volunteer is always All Volunteer, without other qualifiers. If they screw up the data entry, that's on them.

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())

Expand Down
1 change: 0 additions & 1 deletion app/logic/volunteerSpreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def calculateRetentionRate(fallDict, springDict):

return retentionDict


def makeDataXls(sheetName, sheetData, workbook, sheetDesc=None):
# assumes the length of the column titles matches the length of the data
(columnTitles, dataTuples) = sheetData
Expand Down