diff --git a/src/components/pipelines-overview/PipelineRunsNumbersChart.tsx b/src/components/pipelines-overview/PipelineRunsNumbersChart.tsx index e08e3471..12990360 100644 --- a/src/components/pipelines-overview/PipelineRunsNumbersChart.tsx +++ b/src/components/pipelines-overview/PipelineRunsNumbersChart.tsx @@ -86,14 +86,15 @@ const PipelinesRunsNumbersChart: React.FC = ({ useInterval(getSummaryData, interval, namespace, date); const chartData = tickValues?.map((value) => { + const s = data?.summary.find((d) => { + return ( + new Date(d.group_value * 1000).toDateString() === + new Date(value).toDateString() + ); + }); return { x: value, - y: data?.summary.map((d) => { - return new Date(d.group_value * 1000).toDateString() === - new Date(value).toDateString() - ? d.total - : 0; - })[0], + y: s?.total || 0, }; }); diff --git a/src/components/pipelines-overview/PipelineRunsStatusCard.tsx b/src/components/pipelines-overview/PipelineRunsStatusCard.tsx index 55fd2a5d..f9bbb4ef 100644 --- a/src/components/pipelines-overview/PipelineRunsStatusCard.tsx +++ b/src/components/pipelines-overview/PipelineRunsStatusCard.tsx @@ -114,14 +114,15 @@ const PipelinesRunsStatusCard: React.FC = ({ const tickValues = getXaxisValues(timespan); const chartData = tickValues?.map((value) => { + const s = data2?.summary.find((d) => { + return ( + new Date(d.group_value * 1000).toDateString() === + new Date(value).toDateString() + ); + }); return { x: value, - y: data2?.summary.map((d) => { - return new Date(d.group_value * 1000).toDateString() === - new Date(value).toDateString() - ? Math.round((100 * d.succeeded) / d.total) - : 0; - })[0], + y: Math.round((100 * s?.succeeded) / s?.total) || 0, }; });