Skip to content

Commit 6b2b794

Browse files
committed
Do not show negative time in expected benchmark end
1 parent d729dd7 commit 6b2b794

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

site/frontend/src/pages/status/page.vue

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -122,32 +122,34 @@ function ExpectedCurrentRequestCompletion() {
122122
123123
const now = new Date();
124124
const diffSeconds = differenceInSeconds(estimatedCompleted, now);
125-
const prettyDisplay = formatSecondsAsDuration(diffSeconds);
126125
126+
let expectedEnd: string;
127+
if (diffSeconds >= 0) {
128+
let remainingSeconds = formatSecondsAsDuration(diffSeconds);
129+
expectedEnd = `expected to end in approximately ${remainingSeconds}`;
130+
} else {
131+
expectedEnd = "is running longer than expected";
132+
}
133+
134+
let kind = "PR";
135+
let link;
127136
if (req.requestType === "Release") {
128-
return (
129-
<span>
130-
Current Benchmark for{" "}
131-
<strong>
132-
<CommitSha tag={req.tag}></CommitSha>
133-
</strong>{" "}
134-
expected to end in approximately {prettyDisplay}
135-
</span>
136-
);
137+
link = <CommitSha tag={req.tag}></CommitSha>;
138+
kind = "";
137139
} else {
138140
const url = `https://github.com/rust-lang/rust/pull/${req.pr}`;
139-
return (
140-
<span>
141-
Current Benchmark for PR{" "}
142-
<strong>
143-
<a href={url} target="_blank">
144-
#{req.pr}
145-
</a>{" "}
146-
</strong>
147-
expected to end in approximately {prettyDisplay}
148-
</span>
141+
link = (
142+
<a href={url} target="_blank">
143+
#{req.pr}
144+
</a>
149145
);
150146
}
147+
148+
return (
149+
<span>
150+
Current benchmark for {kind} <strong>{link}</strong> {expectedEnd}.
151+
</span>
152+
);
151153
}
152154
153155
function PullRequestLink({request}: {request: BenchmarkRequest}) {

0 commit comments

Comments
 (0)