Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(case): close escalated case when associated incident is closed #5618

Merged
merged 4 commits into from
Dec 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(case): close escalated case when associated incident is closed
whitdog47 committed Dec 13, 2024
commit d2d2be0b44a1693df282c77dfae92ed89f3d2f3c
11 changes: 11 additions & 0 deletions src/dispatch/incident/flows.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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)
whitdog47 marked this conversation as resolved.
Show resolved Hide resolved

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