From dd9650c91badb7f227a8a05f24d64f8fe35b1fb5 Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Tue, 4 Jul 2023 13:39:25 +0200 Subject: [PATCH] Fixes duration in stats --- wasp-ai/src/client/pages/StatsPage.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wasp-ai/src/client/pages/StatsPage.jsx b/wasp-ai/src/client/pages/StatsPage.jsx index 2a9879ab6..224f0e424 100644 --- a/wasp-ai/src/client/pages/StatsPage.jsx +++ b/wasp-ai/src/client/pages/StatsPage.jsx @@ -83,12 +83,18 @@ export function Stats() { } function getDuration(stat) { + if (stat.logs.length < 2) { + return "-"; + } const start = stat.logs[stat.logs.length - 1].createdAt; const end = stat.logs[0].createdAt; return getFormattedDiff(start, end); } function getWaitingInQueueDuration(stat) { + if (stat.logs.length < 2) { + return "-"; + } const start = stat.createdAt; const end = stat.logs[stat.logs.length - 1].createdAt; return getFormattedDiff(start, end);