Skip to content

Commit

Permalink
fix(case): close escalated case when associated incident is closed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Dec 14, 2024
1 parent 6fce74f commit 71114e7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/dispatch/incident/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

from sqlalchemy.orm import Session

from dispatch.case import flows as case_flows
from dispatch.case import service as case_service
from dispatch.case.enums import CaseResolutionReason, CaseStatus
from dispatch.case.models import Case
from dispatch.conference import flows as conference_flows
from dispatch.conversation import flows as conversation_flows
Expand Down Expand Up @@ -544,6 +546,19 @@ def incident_closed_status_flow(incident: Incident, db_session=None):
document=document, db_session=db_session
)

for case in incident.cases:
try:
case.resolution = (
f"Closed as part of incident {incident.name}. See incident for more details."
)
case.resolution_reason = CaseResolutionReason.escalated
case.status = CaseStatus.closed
case_flows.case_closed_status_flow(case=case, db_session=db_session)
except Exception as e:
log.exception(
f"Failed to close case {case.name} while closing incident {incident.name}. Error: {str(e)}"
)

# we send a direct message to the incident commander asking to review
# the incident's information and to tag the incident if appropriate
send_incident_closed_information_review_reminder(incident, db_session)
Expand Down

0 comments on commit 71114e7

Please sign in to comment.