Be less aggressive when validating schedule edit form POST

Somehow deletions were requested for shifts which didn't exist...not
sure how that happened but let's just ignore instead of raise error
This commit is contained in:
Lance Edgar 2017-02-21 11:36:36 -06:00
parent 080e3080af
commit 6b11eb84ea

View file

@ -83,10 +83,10 @@ 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)
if value == 'delete':
shift = self.Session.query(model.ScheduledShift).get(uuid)
if shift:
self.Session.delete(shift)
deleted.append(uuid)
# apply create / update operations