From 5c1fcec490601cf5af1cbe32efc2817d8efeb8a0 Mon Sep 17 00:00:00 2001 From: Max Metz Date: Thu, 24 Oct 2024 15:29:16 +0200 Subject: [PATCH] enabling instant evaluation of the traffic state upon POST and PUT of shipcalls --- src/server/BreCal/impl/shipcalls.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/BreCal/impl/shipcalls.py b/src/server/BreCal/impl/shipcalls.py index 8989335..1891ddd 100644 --- a/src/server/BreCal/impl/shipcalls.py +++ b/src/server/BreCal/impl/shipcalls.py @@ -146,7 +146,7 @@ def PostShipcalls(schemaModel): commands.execute(pquery, param={"shipcall_id" : new_id, "participant_id" : participant_assignment["participant_id"], "type" : participant_assignment["type"]}) # apply 'Traffic Light' evaluation to obtain 'GREEN', 'YELLOW' or 'RED' evaluation state. The function internally updates the mysql database - # evaluate_shipcall_state(mysql_connector_instance=pooledConnection, shipcall_id=new_id) # new_id (last insert id) refers to the shipcall id + evaluate_shipcall_state(mysql_connector_instance=pooledConnection, shipcall_id=new_id) # new_id (last insert id) refers to the shipcall id # save history data # TODO: set ETA properly @@ -260,6 +260,9 @@ def PutShipcalls(schemaModel): dquery = "DELETE FROM shipcall_participant_map WHERE id = ?existing_id?" commands.execute(dquery, param={"existing_id" : elem["id"]}) + # re-evaluate the shipcall + evaluate_shipcall_state(mysql_connector_instance=pooledConnection, shipcall_id=schemaModel["id"]) + # save history data # TODO: set ETA properly # query = SQLQuery.create_sql_query_history_put()