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()
|
pooledConnection.close()
|
||||||
return json.dumps("no such record"), 404, {'Content-Type': 'application/json; charset=utf-8'}
|
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 = SQLQuery.get_shipcall_put(schemaModel)
|
||||||
query = "UPDATE shipcall SET "
|
query = "UPDATE shipcall SET "
|
||||||
isNotFirst = False
|
isNotFirst = False
|
||||||
@ -305,6 +307,13 @@ def PutShipcalls(schemaModel):
|
|||||||
commands.execute(nquery, param={"shipcall_id" : schemaModel["id"], "participant_id" : elem["participant_id"], "message" : message})
|
commands.execute(nquery, param={"shipcall_id" : schemaModel["id"], "participant_id" : elem["participant_id"], "message" : message})
|
||||||
break
|
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
|
# save history data
|
||||||
# TODO: set ETA properly
|
# TODO: set ETA properly
|
||||||
# query = SQLQuery.create_sql_query_history_put()
|
# query = SQLQuery.create_sql_query_history_put()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user