Skip to content

Address reported issues for the detail chart #1847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions site/frontend/src/pages/compare/compile/table/benchmark-detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,20 @@ function getGraphRange(
// ranges. If the commit range is not larger than the `dayRange`, the display will likely be
// "centered" around the commit date.

// Calculate the end of the range, which is commit date + half of the
// amount of days we want to show. If this date is in the future,
// the server will clip the result at the current date.
const end = formatDate(getFutureDate(end_date, DAY_RANGE / 2));
// Calculate the end of the range, which is the earlier date between
// current date and the commit date + half of the amount of days we
// want to show.
let centered_end = getFutureDate(end_date, DAY_RANGE / 2);
const today = new Date().setUTCHours(0, 0, 0, 0);
if (centered_end.getTime() > today) {
centered_end = new Date(today);
}
const end = formatDate(centered_end);

// Calculate the start of the range, which is the earlier date between
// the base artifact date and the commit date - half of the amount of days
// the base artifact date and the calculated end date - the amount of days
// we want to show.
const centered_start = getPastDate(end_date, DAY_RANGE / 2);
const centered_start = getPastDate(centered_end, DAY_RANGE);
const start = formatDate(
start_date < centered_start ? start_date : centered_start
);
Expand Down Expand Up @@ -253,7 +258,7 @@ function graphLink(
testCase: CompileTestCase
): string {
// Move to `30 days ago` to display history of the test case
const start = getPastDate(new Date(commit.date), 30);
const start = formatDate(getPastDate(new Date(commit.date), 30));
const end = commit.commit;
const {benchmark, profile, scenario} = testCase;
return `/index.html?start=${start}&end=${end}&benchmark=${benchmark}&profile=${profile}&scenario=${scenario}&stat=${metric}`;
Expand Down