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 committed Dec 13, 2024
1 parent ad45c42 commit d2d2be0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 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,15 @@ def incident_closed_status_flow(incident: Incident, db_session=None):
document=document, db_session=db_session
)

# if there are any associated cases, we close them as well
for case in incident.cases:
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)

# 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 d2d2be0

Please sign in to comment.