Skip to content

Commit

Permalink
Fix the state being set and approver names being overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavberi committed Mar 23, 2024
1 parent 13c775c commit 38e584d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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"]:
Expand All @@ -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:
Expand All @@ -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}})
Expand Down

0 comments on commit 38e584d

Please sign in to comment.