diff --git a/src/handlebars_util.rs b/src/handlebars_util.rs index f5f5e82..eae09f3 100644 --- a/src/handlebars_util.rs +++ b/src/handlebars_util.rs @@ -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 diff --git a/templates/stats.hbs b/templates/stats.hbs index 7f210a2..a691ac4 100644 --- a/templates/stats.hbs +++ b/templates/stats.hbs @@ -19,6 +19,11 @@ {{#each categories_stats}} {{#if this.last_session_start}}
+

+ Kategori: + {{this.category.name}} + +

Senaste session: {{pretty_datetime this.last_session_start}} @@ -26,11 +31,9 @@ {{pretty_seconds this.secs_last_session}}

- Denna veckan: + Senaste veckan: {{pretty_seconds this.secs_last_week}} -

-

- Denna månaden: + Senaste månaden: {{pretty_seconds this.secs_last_month}}

Andel per timme: