Fix formatting of /stats
This commit is contained in:
@ -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
|
||||
|
||||
@ -19,6 +19,11 @@
|
||||
{{#each categories_stats}}
|
||||
{{#if this.last_session_start}}
|
||||
<div class="hline"></div>
|
||||
<h2>
|
||||
<span>Kategori:</span>
|
||||
<span>{{this.category.name}}</span>
|
||||
<span style="color: {{this.category.color}};">●</span>
|
||||
</h2>
|
||||
<h2>
|
||||
<span>Senaste session:</span>
|
||||
<span class="history_entry_started">{{pretty_datetime this.last_session_start}}</span>
|
||||
@ -26,11 +31,9 @@
|
||||
<span class="history_entry_duration">{{pretty_seconds this.secs_last_session}}</span>
|
||||
</h2>
|
||||
<h2>
|
||||
<span>Denna veckan:</span>
|
||||
<span>Senaste veckan:</span>
|
||||
<span class="history_entry_duration">{{pretty_seconds this.secs_last_week}}</span>
|
||||
</h2>
|
||||
<h2>
|
||||
<span>Denna månaden:</span>
|
||||
<span>Senaste månaden:</span>
|
||||
<span class="history_entry_duration">{{pretty_seconds this.secs_last_month}}</span>
|
||||
</h2>
|
||||
<h2>Andel per timme:</h2>
|
||||
|
||||
Reference in New Issue
Block a user