Fix generateDurationString()
It would show `1 1 hour 5 min` instead of `1 hour 5 min`.
Change-Id: Ie2fa80dca80b9a71c98d6dd2eaec4397939e5b59
diff --git a/gr-checks/gr-checks-reboot.js b/gr-checks/gr-checks-reboot.js
index 4f673ac..17f8ecd 100644
--- a/gr-checks/gr-checks-reboot.js
+++ b/gr-checks/gr-checks-reboot.js
@@ -44,17 +44,17 @@
const hoursAgo = Math.floor(minutesAgo / 60);
if (hoursAgo % 24 !== 0) {
const hours = pluralize(hoursAgo % 24, 'hour', 'hours');
- durationSegments.push(`${hoursAgo % 24} ${hours}`);
+ durationSegments.push(`${hours}`);
}
const daysAgo = Math.floor(hoursAgo / 24);
if (daysAgo % 30 !== 0) {
const days = pluralize(daysAgo % 30, 'day', 'days');
- durationSegments.push(`${daysAgo % 30} ${days}`);
+ durationSegments.push(`${days}`);
}
const monthsAgo = Math.floor(daysAgo / 30);
if (monthsAgo > 0) {
const months = pluralize(monthsAgo, 'month', 'months');
- durationSegments.push(`${monthsAgo} ${months}`);
+ durationSegments.push(`${months}`);
}
return durationSegments.reverse().slice(0, 2).join(' ');
}