diff --git a/tailbone/views/shifts/schedule.py b/tailbone/views/shifts/schedule.py index 08db8150..26bb65cd 100644 --- a/tailbone/views/shifts/schedule.py +++ b/tailbone/views/shifts/schedule.py @@ -83,11 +83,11 @@ class ScheduleView(TimeSheetView): # apply delete operations deleted = [] for uuid, value in data['delete'].iteritems(): - assert value == 'delete' - shift = Session.query(model.ScheduledShift).get(uuid) - assert shift - Session.delete(shift) - deleted.append(uuid) + if value == 'delete': + shift = self.Session.query(model.ScheduledShift).get(uuid) + if shift: + self.Session.delete(shift) + deleted.append(uuid) # apply create / update operations created = {}