From e3b0ada441c4f8c75e8f466dd391ccd80c551d05 Mon Sep 17 00:00:00 2001 From: Trey Ivy Date: Mon, 28 Oct 2024 15:25:59 +0000 Subject: [PATCH] fix graph displaying negative durations --- frontend/src/app/trends/page.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/trends/page.tsx b/frontend/src/app/trends/page.tsx index dde3120..6b151e1 100644 --- a/frontend/src/app/trends/page.tsx +++ b/frontend/src/app/trends/page.tsx @@ -15,7 +15,7 @@ import CountUp from 'react-countup'; const Page: React.FC = () => { const [variables, setVariables] = useState({ - first: 10000, + first: 1000, }); const { loading, data, previousData, error } = useQuery(FIND_BUILD_DURATIONS, { @@ -52,7 +52,11 @@ const Page: React.FC = () => { to: x.endedAt, duration: (new Date(x.endedAt).getTime() - new Date(x.startedAt).getTime()) } - dataPoints.push(point) + // if there are empty/nil dates they get set to max epoch start time + // which throws the graph off. + if (point.duration > 0) { + dataPoints.push(point) + } }); const formatter: StatisticProps['formatter'] = (value) => ( @@ -84,14 +88,14 @@ const Page: React.FC = () => { } - titleBits={[Invocation Durations ]}> + titleBits={[Invocation Durations]}> + -