From 38e584d924c9244c2ef8811668b675d728078168 Mon Sep 17 00:00:00 2001 From: Bhav Beri Date: Sat, 23 Mar 2024 13:56:42 +0530 Subject: [PATCH] Fix the state being set and approver names being overwritten --- mutations.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mutations.py b/mutations.py index f82207f..af05cdc 100644 --- a/mutations.py +++ b/mutations.py @@ -257,6 +257,9 @@ def progressEvent( "room": False, # or len(event_instance.location) == 0, "state": Event_State_Status.pending_cc.value, + "cc_approver": event_instance.status.cc_approver, + "slc_approver": event_instance.status.slc_approver, + "slo_approver": event_instance.status.slo_approver, } elif event_instance.status.state == Event_State_Status.pending_cc: @@ -267,6 +270,9 @@ def progressEvent( # or sum([b.amount for b in event_instance.budget]) == 0, "room": event_instance.status.room, # or len(event_instance.location) == 0, + "cc_approver": user["uid"], + "slc_approver": event_instance.status.slc_approver, + "slo_approver": event_instance.status.slo_approver, } if cc_progress_budget is not None: updation["budget"] = cc_progress_budget @@ -293,6 +299,8 @@ def progressEvent( "room": event_instance.status.room, # | len(event_instance.location) == 0, "slc_approver": user["uid"], + "slo_approver": event_instance.status.slo_approver, + "cc_approver": event_instance.status.cc_approver, } if not updation["room"]: @@ -310,6 +318,8 @@ def progressEvent( "room": True, "state": Event_State_Status.approved.value, "slo_approver": user["uid"], + "slc_approver": event_instance.status.slc_approver, + "cc_approver": event_instance.status.cc_approver, } elif event_instance.status.state == Event_State_Status.approved: @@ -322,6 +332,9 @@ def progressEvent( "budget": event_instance.status.budget, "room": event_instance.status.room, "state": Event_State_Status.approved.value, + "cc_approver": event_instance.status.cc_approver, + "slc_approver": event_instance.status.slc_approver, + "slo_approver": event_instance.status.slo_approver, } upd_ref = eventsdb.update_one({"_id": eventid}, {"$set": {"status": updation}})