Rename stats to statistics (BC) (#10551)

This commit is contained in:
andig 2023-10-29 12:29:53 +01:00 • committed by GitHub
parent 4bddf556df
commit da68bc03b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 14 deletions

View file

@ -212,7 +212,7 @@ export default {
components: { Sponsor, SavingsTile, LiveCommunity, TelemetrySettings, CustomSelect }, components: { Sponsor, SavingsTile, LiveCommunity, TelemetrySettings, CustomSelect },
mixins: [formatter], mixins: [formatter],
props: { props: {
stats: { type: Object, default: () => ({}) }, statistics: { type: Object, default: () => ({}) },
co2Configured: Boolean, co2Configured: Boolean,
sponsor: String, sponsor: String,
currency: String, currency: String,
@ -256,7 +256,7 @@ export default {
}, },
avgPriceFormatted() { avgPriceFormatted() {
const value = this.fmtPricePerKWh( const value = this.fmtPricePerKWh(
this.currentStats.avgPrice, this.currentStatistics.avgPrice,
this.currency, this.currency,
false, false,
false false
@ -264,14 +264,14 @@ export default {
const unit = this.pricePerKWhUnit(this.currency); const unit = this.pricePerKWhUnit(this.currency);
return { value, unit }; return { value, unit };
}, },
currentStats() { currentStatistics() {
return this.stats[this.period] || {}; return this.statistics[this.period] || {};
}, },
totalCharged() { totalCharged() {
return this.currentStats.chargedKWh; return this.currentStatistics.chargedKWh;
}, },
solarPercentage() { solarPercentage() {
return this.currentStats.solarPercentage; return this.currentStatistics.solarPercentage;
}, },
solarCharged() { solarCharged() {
return (this.solarPercentage / 100) * this.totalCharged; return (this.solarPercentage / 100) * this.totalCharged;
@ -280,10 +280,10 @@ export default {
return this.totalCharged - this.solarCharged; return this.totalCharged - this.solarCharged;
}, },
avgPrice() { avgPrice() {
return this.currentStats.avgPrice; return this.currentStatistics.avgPrice;
}, },
avgCo2() { avgCo2() {
return this.currentStats.avgCo2; return this.currentStatistics.avgCo2;
}, },
priceConfigured() { priceConfigured() {
return this.referenceGrid !== undefined; return this.referenceGrid !== undefined;

View file

@ -80,7 +80,7 @@ export default {
auth: Object, auth: Object,
currency: String, currency: String,
stats: Object, statistics: Object,
tariffFeedIn: Number, tariffFeedIn: Number,
tariffGrid: Number, tariffGrid: Number,
tariffCo2: Number, tariffCo2: Number,
@ -136,7 +136,7 @@ export default {
}, },
sponsor: this.sponsor, sponsor: this.sponsor,
savings: { savings: {
stats: this.stats, statistics: this.statistics,
co2Configured: this.tariffCo2 !== undefined, co2Configured: this.tariffCo2 !== undefined,
priceConfigured: this.tariffGrid !== undefined, priceConfigured: this.tariffGrid !== undefined,
currency: this.currency, currency: this.currency,

View file

@ -30,12 +30,12 @@ func (s *Stats) Update(p publisher) {
return return
} }
var stats = map[string]map[string]float64{ stats := map[string]map[string]float64{
"30d": s.calculate(30), "30d": s.calculate(30),
"365d": s.calculate(365), "365d": s.calculate(365),
"total": s.calculate(365 * 100), // 100 years "total": s.calculate(365 * 100), // 100 years
} }
p.publish("stats", stats) p.publish("statistics", stats)
s.updated = time.Now() s.updated = time.Now()
} }

View file

@ -19,6 +19,7 @@ var deprecatedTopics = []string{
"activePhases", "range", "socCharge", "activePhases", "range", "socCharge",
"vehicleSoC", "batterySoC", "bufferSoC", "minSoC", "prioritySoC", "targetSoC", "vehicleTargetSoC", "vehicleSoC", "batterySoC", "bufferSoC", "minSoC", "prioritySoC", "targetSoC", "vehicleTargetSoC",
"savingsAmount", "savingsEffectivePrice", "savingsGridCharged", "savingsSelfConsumptionCharged", "savingsSelfConsumptionPercent", "savingsTotalCharged", "savingsAmount", "savingsEffectivePrice", "savingsGridCharged", "savingsSelfConsumptionCharged", "savingsSelfConsumptionPercent", "savingsTotalCharged",
"stats/30d", "stats/365d", "stats/total",
} }
// MQTT is the MQTT server. It uses the MQTT client for publishing. // MQTT is the MQTT server. It uses the MQTT client for publishing.

View file

@ -2,7 +2,7 @@ const { test, expect } = require("@playwright/test");
const { start, stop } = require("./evcc"); const { start, stop } = require("./evcc");
test.beforeAll(async () => { test.beforeAll(async () => {
await start("stats.evcc.yaml", "stats.sql"); await start("statistics.evcc.yaml", "statistics.sql");
}); });
test.afterAll(async () => { test.afterAll(async () => {
await stop(); await stop();
@ -32,7 +32,7 @@ test.describe("footer", async () => {
}); });
}); });
test.describe.skip("stats values", async () => { test.describe.skip("statistics values", async () => {
test("last 30 days", async ({ page }) => { test("last 30 days", async ({ page }) => {
await page.goto("/"); await page.goto("/");
await page.getByTestId("savings-button").click(); await page.getByTestId("savings-button").click();