Skip to content

Commit 14eeeac

Browse files
fix: filter critical incidents warning to only count P1-P3 (#240)
The "critical incidents created in the past hour" warning was counting all incidents regardless of priority. Now filters on priority value <= 3 (P1, P2, P3) to match the actual definition of critical incidents.
1 parent 6c3259e commit 14eeeac

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/firefighter/slack/views/modals/open.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ def get_intro_blocks() -> list[Block]:
172172
]
173173

174174
recent_critical_incidents: int = Incident.objects.filter(
175-
created_at__gte=timezone.now() - timedelta(hours=1)
175+
created_at__gte=timezone.now() - timedelta(hours=1),
176+
priority__value__lte=3,
176177
).count()
177178
if recent_critical_incidents > 0:
178179
blocks.append(

src/firefighter/slack/views/modals/opening/check_current_incidents.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def build_modal_fn(body: dict[str, Any], **kwargs: Any) -> View:
3737

3838
incidents = list(
3939
Incident.objects.filter(
40-
41-
created_at__gte=datetime.now(UTC) - timedelta(hours=1)
40+
created_at__gte=datetime.now(UTC) - timedelta(hours=1),
41+
priority__value__lte=3,
4242
)
4343
.order_by("-created_at")
4444
.select_related(

0 commit comments

Comments
 (0)