Skip to content

Commit 1d405ae

Browse files
Do not remove the cost model when updating the incident. (Netflix#4567)
1 parent 2bb1bfb commit 1d405ae

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/dispatch/incident/service.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
:copyright: (c) 2019 by Netflix Inc., see AUTHORS for more
55
:license: Apache, see LICENSE for more details.
66
"""
7+
78
import logging
89

910
from datetime import datetime, timedelta
@@ -338,12 +339,14 @@ def update(*, db_session, incident: Incident, incident_in: IncidentUpdate) -> In
338339
incident_priority_in=incident_in.incident_priority,
339340
)
340341

341-
cost_model = None
342-
if incident_in.cost_model and incident_in.cost_model.id != incident.cost_model_id:
343-
cost_model = cost_model_service.get_cost_model_by_id(
342+
cost_model = (
343+
cost_model_service.get_cost_model_by_id(
344344
db_session=db_session,
345345
cost_model_id=incident_in.cost_model.id,
346346
)
347+
if incident_in.cost_model
348+
else None
349+
)
347350

348351
cases = []
349352
for c in incident_in.cases:

0 commit comments

Comments
 (0)