diff --git a/frontend/src/pages/TestsPage.tsx b/frontend/src/pages/TestsPage.tsx index 3b6390e..1c6188b 100644 --- a/frontend/src/pages/TestsPage.tsx +++ b/frontend/src/pages/TestsPage.tsx @@ -224,8 +224,8 @@ export default function TestsPage() { bv = b.created_at || ""; break; case "updated_at": - av = a.updated_at || ""; - bv = b.updated_at || ""; + av = lastActivityDate(a) || ""; + bv = lastActivityDate(b) || ""; break; case "waiting_time": { const aIsBlue = a.state === "blue_evaluating"; @@ -281,6 +281,23 @@ export default function TestsPage() { }); }; + // updated_at doesn't exist in DB — derive "last activity" from the most + // recent non-null timestamp available on the test record + const lastActivityDate = (t: import("../types/models").Test): string | null => { + const candidates = [ + t.blue_validated_at, + t.red_validated_at, + (t as any).blue_work_started_at, + (t as any).blue_started_at, + (t as any).red_started_at, + t.created_at, + ].filter(Boolean) as string[]; + if (!candidates.length) return null; + return candidates.reduce((latest, d) => + new Date(d) > new Date(latest) ? d : latest + ); + }; + // ── My tasks label ──────────────────────────────────────────────── const myTasksLabel = useMemo(() => { if (!user) return "My Tasks"; @@ -594,7 +611,7 @@ export default function TestsPage() { {formatDate(test.created_at)} - {formatDate(test.updated_at)} + {formatDate(lastActivityDate(test))}