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 all commits
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
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
Loading