Skip to content

Commit

Permalink
shows correct data on BarCharts
Browse files Browse the repository at this point in the history
  • Loading branch information
vikram-raj committed Dec 13, 2023
1 parent 04e06dd commit 4cc8bf4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions src/components/pipelines-overview/PipelineRunsNumbersChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,15 @@ const PipelinesRunsNumbersChart: React.FC<PipelinesRunsNumbersChartProps> = ({
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,
};
});

Expand Down
13 changes: 7 additions & 6 deletions src/components/pipelines-overview/PipelineRunsStatusCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ const PipelinesRunsStatusCard: React.FC<PipelinesRunsStatusCardProps> = ({
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,
};
});

Expand Down

0 comments on commit 4cc8bf4

Please sign in to comment.