Fix formatting of /stats

This commit is contained in:
2020-11-12 14:43:44 +01:00
parent 70c354fa6d
commit af434f0bc0
2 changed files with 12 additions and 7 deletions

View File

@ -14,10 +14,12 @@ pub fn register_helpers(engines: &mut Engines) {
handlebars_helper!(pretty_seconds: |secs: u64| {
let hours = secs / 60 / 60;
let minutes = secs / 60 % 60;
if hours > 0 {
format!("{}h {}m", hours, minutes)
} else {
if hours == 0 {
format!("{}m", minutes)
} else if minutes == 0 {
format!("{}h", hours)
} else {
format!("{}h {}m", hours, minutes)
}
});
engines