From cc8ba93bdaea618524cec03b17357a41fd3c35a0 Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Tue, 7 Jan 2025 14:10:28 -0800 Subject: [PATCH] Pivotal story #188742640, need to `mark_next_outgoing()` AFTER changing status of communication request. --- isacc_messaging/api/isacc_record_creator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/isacc_messaging/api/isacc_record_creator.py b/isacc_messaging/api/isacc_record_creator.py index e72f5ea..dbc8803 100644 --- a/isacc_messaging/api/isacc_record_creator.py +++ b/isacc_messaging/api/isacc_record_creator.py @@ -342,10 +342,7 @@ def execute_requests(self) -> Tuple[List[dict], List[dict]]: sent = 0 for cr_json in next_in_bundle(result): cr = CommunicationRequest(cr_json) - # as that message was likely the next-outgoing for the patient, - # update the extension used to track next-outgoing-message time patient = resolve_reference(cr.recipient[0].reference) - patient.mark_next_outgoing() # Do not interact with CR if the patient is inactive or sending date is past the cutoff if not patient.active or cr.occurrenceDateTime.date < cutoff: @@ -358,6 +355,7 @@ def execute_requests(self) -> Tuple[List[dict], List[dict]]: revoked_reason = "Past the cutoff" cr.report_cr_status(status_reason=revoked_reason) errors.append({'id': cr.id, 'error': revoked_reason}) + patient.mark_next_outgoing() # update given state change continue # Otherwise, create a communication @@ -384,6 +382,7 @@ def execute_requests(self) -> Tuple[List[dict], List[dict]]: extra={"Updated Communication": stopped_comm}, level='debug' ) + patient.mark_next_outgoing() # update given state change continue # Otherwise, update according to the feedback from the dispatch @@ -419,6 +418,7 @@ def execute_requests(self) -> Tuple[List[dict], List[dict]]: extra={"resource": f"Communication/{comm.id}", "statusReason": e}, level='exception' ) + patient.mark_next_outgoing() # update given state change # Flooding system on occasions such as a holiday message to all, # leads to an overwhelmed system. Restrict the flood by processing