Skip to content

Commit

Permalink
Savings UI: add this year option (evcc-io#15578)
Browse files Browse the repository at this point in the history
  • Loading branch information
naltatis authored Aug 21, 2024
1 parent de80adb commit d242cd5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/js/components/Savings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default {
return co2Reference.regions[0];
},
periodOptions() {
return ["30d", "365d", "total"].map((p) => ({
return ["30d", "365d", "thisYear", "total"].map((p) => ({
value: p,
name: this.$t(`footer.savings.period.${p}`),
}));
Expand Down
7 changes: 4 additions & 3 deletions core/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ func (s *Stats) Update(p publisher) {
}

stats := map[string]map[string]float64{
"30d": s.calculate(30),
"365d": s.calculate(365),
"total": s.calculate(365 * 100), // 100 years
"30d": s.calculate(30),
"365d": s.calculate(365),
"thisYear": s.calculate(time.Now().YearDay()),
"total": s.calculate(365 * 100), // 100 years
}
p.publish(keys.Statistics, stats)

Expand Down
1 change: 1 addition & 0 deletions i18n/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ tabTitle = "Meine Daten"
[footer.savings.period]
30d = "letzte 30 Tage"
365d = "letzte 365 Tage"
thisYear = "dieses Jahr"
total = "gesamt"

[footer.sponsor]
Expand Down
1 change: 1 addition & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ tabTitle = "My data"
[footer.savings.period]
30d = "last 30 days"
365d = "last 365 days"
thisYear = "this year"
total = "all time"

[footer.sponsor]
Expand Down

0 comments on commit d242cd5

Please sign in to comment.