Skip to content

Commit

Permalink
tasks.js: Add duration and builder name
Browse files Browse the repository at this point in the history
Signed-off-by: Rune Morling <[email protected]>
  • Loading branch information
ermo committed Sep 21, 2024
1 parent 3127798 commit 261b3f8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion static/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ export function renderTask(task)
const ended = task.tsEnded != 0 ? new Date(task.tsEnded * 1000).toLocaleString() : "--";
const status = renderStatus(task.status);

const timestamp = task.tsEnded != 0 ? "Ended @ " + ended : "Started @ " + started;
if (task.tsEnded != 0) {
const difference = started - ended;
//Arrange the difference of date in hours, minutes, and seconds format
const hours = Math.floor((difference / (1000 * 60 * 60)));
const minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((difference % (1000 * 60)) / 1000);
const duration = hours + "h" + minutes + "m" + seconds + "s";
}
const timestamp = task.tsEnded != 0 ? "Ended @ " + ended + " (" + task.allocatedBuilder + ": " + duration + ")" : "Started @ " + started + " on " task.allocatedBuilder;
return `
<div class="list-group-item list-group-item-hoverable">
<div class="row align-items-center">
Expand Down

0 comments on commit 261b3f8

Please sign in to comment.