From 4e625ca99b6b48ad2d7ecb1e7e762f25e02d6d33 Mon Sep 17 00:00:00 2001 From: Jason Crawford Date: Sun, 22 Feb 2026 17:19:45 -0800 Subject: [PATCH] fix: show correct check range on incident detail page Use the triggering check's timestamp as the lower bound (instead of incident.opened_at) so the first check is included. For resolved incidents, cap the range at resolved_at so checks after closure aren't shown. Rename heading to "Checks During Incident". Fixes #45 Co-Authored-By: Claude Opus 4.6 --- src/app/incidents/[id]/page.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/incidents/[id]/page.tsx b/src/app/incidents/[id]/page.tsx index 56edd9c..c850a2a 100644 --- a/src/app/incidents/[id]/page.tsx +++ b/src/app/incidents/[id]/page.tsx @@ -22,13 +22,19 @@ async function getIncidentData(id: string) { const typedIncident = incident as IncidentWithRelations - const { data: checks } = await supabase + let checksQuery = supabase .from("checks") .select("*") .eq("site_id", typedIncident.site_id) - .gte("checked_at", typedIncident.opened_at) + .gte("checked_at", typedIncident.check.checked_at) .order("checked_at", { ascending: false }) + if (typedIncident.resolved_at) { + checksQuery = checksQuery.lte("checked_at", typedIncident.resolved_at) + } + + const { data: checks } = await checksQuery + return { incident: typedIncident, checks: (checks ?? []) as Check[], @@ -178,7 +184,7 @@ export default async function IncidentDetailPage({ className="text-[22px] font-bold mb-4" style={{ color: "#1A1A1A", letterSpacing: "-0.01em" }} > - Checks Since Incident Opened + Checks During Incident