Skip to content

Commit

Permalink
Merge pull request #57 from saumeya/quarter-week
Browse files Browse the repository at this point in the history
ODC-7470: fix logic for quarterly week grouping
  • Loading branch information
openshift-merge-bot[bot] authored Feb 1, 2024
2 parents 4bc4767 + 5129925 commit 38060e7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,12 @@ const getChartData = (
if (type == 'hour') {
return new Date(d.group_value * 1000).getHours() === value;
}
if (type == 'day') {
if (type == 'day' || type == 'week') {
return (
new Date(d.group_value * 1000).toDateString() ===
new Date(value).toDateString()
);
}
if (type == 'week') {
const wDate = new Date(d.group_value * 1000);
const weekend = new Date(value);
weekend.setDate(weekend.getDate() + 6);
return wDate >= new Date(value) && wDate <= weekend;
}
if (type == 'month') {
return new Date(d.group_value * 1000).getMonth() === value.getMonth();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,12 @@ const getChartData = (
if (type == 'hour') {
return new Date(d.group_value * 1000).getHours() === value;
}
if (type == 'day') {
if (type == 'day' || type == 'week') {
return (
new Date(d.group_value * 1000).toDateString() ===
new Date(value).toDateString()
);
}
if (type == 'week') {
const wDate = new Date(d.group_value * 1000);
const weekend = new Date(value);
weekend.setDate(weekend.getDate() + 6);
return wDate >= new Date(value) && wDate <= weekend;
}
if (type == 'month') {
return new Date(d.group_value * 1000).getMonth() === value.getMonth();
}
Expand Down
8 changes: 1 addition & 7 deletions src/components/pipelines-overview/PipelineRunsStatusCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,12 @@ const getChartData = (
if (type == 'hour') {
return new Date(d.group_value * 1000).getHours() === value;
}
if (type == 'day') {
if (type == 'day' || type == 'week') {
return (
new Date(d.group_value * 1000).toDateString() ===
new Date(value).toDateString()
);
}
if (type == 'week') {
const wDate = new Date(d.group_value * 1000);
const weekend = new Date(value);
weekend.setDate(weekend.getDate() + 6);
return wDate >= new Date(value) && wDate <= weekend;
}
if (type == 'month') {
return new Date(d.group_value * 1000).getMonth() === value.getMonth();
}
Expand Down

0 comments on commit 38060e7

Please sign in to comment.