creating notifications if a shipcall is cancelled
This commit is contained in:
parent
91caf74dca
commit
cda3f231a7
@ -208,6 +208,8 @@ def PutShipcalls(schemaModel):
|
||||
pooledConnection.close()
|
||||
return json.dumps("no such record"), 404, {'Content-Type': 'application/json; charset=utf-8'}
|
||||
|
||||
was_canceled = theshipcall["canceled"]
|
||||
|
||||
# query = SQLQuery.get_shipcall_put(schemaModel)
|
||||
query = "UPDATE shipcall SET "
|
||||
isNotFirst = False
|
||||
@ -305,6 +307,13 @@ def PutShipcalls(schemaModel):
|
||||
commands.execute(nquery, param={"shipcall_id" : schemaModel["id"], "participant_id" : elem["participant_id"], "message" : message})
|
||||
break
|
||||
|
||||
if schemaModel["canceled"] is not None:
|
||||
if schemaModel["canceled"] and not was_canceled:
|
||||
# create a canceled notification for all currently assigned participants
|
||||
stornoNotificationQuery = "INSERT INTO notification (shipcall_id, participant_id, level, type, message) VALUES (?shipcall_id?, ?participant_id?, 0, 7, ?message?)"
|
||||
for participant_assignment in schemaModel["participants"]:
|
||||
commands.execute(stornoNotificationQuery, param={"shipcall_id" : schemaModel["id"], "participant_id" : participant_assignment["participant_id"], "message" : message})
|
||||
|
||||
# save history data
|
||||
# TODO: set ETA properly
|
||||
# query = SQLQuery.create_sql_query_history_put()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user