File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<template lang="pug">
22div
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
3838import _ from ' lodash' ;
3939import { useActivityStore } from ' ~/stores/activity' ;
4040import { 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 );
You can’t perform that action at this time.
0 commit comments