Skip to content

Commit

Permalink
Merge pull request openshift-pipelines#30 from vikram-raj/ocpbugs-25334
Browse files Browse the repository at this point in the history
OCPBUGS-25334: shows correct data on BarCharts
  • Loading branch information
openshift-merge-bot[bot] authored Dec 13, 2023
2 parents 00b6d71 + 4cc8bf4 commit 57033bc
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 @@ -93,14 +93,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 @@ -120,14 +120,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 57033bc

Please sign in to comment.