From aeee2c8941beb461d090d10b9244507359fa2cbb Mon Sep 17 00:00:00 2001 From: Louis Knight-Webb Date: Mon, 16 Jun 2025 20:27:25 -0400 Subject: [PATCH] Show latest attempt --- frontend/src/components/tasks/TaskDetailsDialog.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/components/tasks/TaskDetailsDialog.tsx b/frontend/src/components/tasks/TaskDetailsDialog.tsx index c6b35148..9308472e 100644 --- a/frontend/src/components/tasks/TaskDetailsDialog.tsx +++ b/frontend/src/components/tasks/TaskDetailsDialog.tsx @@ -108,6 +108,14 @@ export function TaskDetailsDialog({ const result: ApiResponse = await response.json(); if (result.success && result.data) { setTaskAttempts(result.data); + // Automatically select the latest attempt if available + if (result.data.length > 0) { + const latestAttempt = result.data.reduce((latest, current) => + new Date(current.created_at) > new Date(latest.created_at) ? current : latest + ); + setSelectedAttempt(latestAttempt); + fetchAttemptActivities(latestAttempt.id); + } } } else { onError("Failed to load task attempts");