Skip to content

Commit 5c04d24

Browse files
fix(score): show selected period label (#845)
1 parent c72fffa commit 5c04d24

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/visualizations/Score.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template lang="pug">
22
div
33
div(style="text-align: center")
4-
| Your total score today is:
4+
| Your total score for {{ score_period_label }} is:
55
div(:style="'font-size: 2em; color: ' + (score >= 0 ? '#0A0' : '#F00')")
66
| {{score >= 0 ? '+' : ''}}{{ (Math.round(score * 10) / 10).toFixed(1) }}
77
div.small.text-muted
@@ -38,6 +38,7 @@ div
3838
import _ from 'lodash';
3939
import { useActivityStore } from '~/stores/activity';
4040
import { IEvent } from '~/util/interfaces';
41+
import { periodReadable } from '~/util/timeperiod';
4142
4243
// TODO: Maybe add a "Category Tree"-style visualization?
4344
@@ -55,6 +56,10 @@ export default {
5556
score: function (): number {
5657
return _.sum(_.map(this.categories_with_score, cat => cat.data.$total_score));
5758
},
59+
score_period_label: function (): string {
60+
const timeperiod = useActivityStore().query_options?.timeperiod;
61+
return timeperiod ? periodReadable(timeperiod) : 'selected period';
62+
},
5863
score_productive_percent() {
5964
// Compute the percentage of time spent on productive activities (score > 0)
6065
const total_time = _.sumBy(this.categories_with_score as IEvent[], cat => cat.duration);

0 commit comments

Comments
 (0)