From 40a391da69ec68192085a4ea4aa180fc71f12a75 Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Sun, 15 Oct 2023 16:14:35 +0200 Subject: [PATCH] Show plan active status only in active timeslots (#10332) --- assets/js/components/VehicleStatus.test.js | 17 +++++++++++++---- assets/js/components/VehicleStatus.vue | 7 ++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/assets/js/components/VehicleStatus.test.js b/assets/js/components/VehicleStatus.test.js index 01ba809a1..c016bce79 100644 --- a/assets/js/components/VehicleStatus.test.js +++ b/assets/js/components/VehicleStatus.test.js @@ -41,14 +41,23 @@ describe("min charge", () => { }); }); -describe("target charge", () => { +describe("plan", () => { const targetTime = "2020-03-16T06:00:00Z"; const planProjectedStart = "2020-03-16T02:00:00Z"; - test("active if target time is set and status is charging", () => { - expectStatus({ targetTime, charging: true, connected: true }, "targetChargeActive"); + test("charging if target time is set, status is charging but planned slot is not active", () => { + expectStatus({ targetTime, charging: true, connected: true }, "charging"); + }); + test("active if target time is set, status is charging and planned slot is active", () => { + expectStatus( + { targetTime, planActive: true, charging: true, connected: true }, + "targetChargeActive" + ); }); test("waiting for vehicle if a target time is set, the charger is enabled but not charging", () => { - expectStatus({ targetTime, enabled: true, connected: true }, "targetChargeWaitForVehicle"); + expectStatus( + { targetTime, planActive: true, enabled: true, connected: true }, + "targetChargeWaitForVehicle" + ); }); test("show projected start if not enabled yet", () => { expectStatus({ targetTime, planProjectedStart, connected: true }, "targetChargePlanned", { diff --git a/assets/js/components/VehicleStatus.vue b/assets/js/components/VehicleStatus.vue index 4e212ace2..c4b4b9590 100644 --- a/assets/js/components/VehicleStatus.vue +++ b/assets/js/components/VehicleStatus.vue @@ -18,6 +18,7 @@ export default { charging: Boolean, targetTime: String, planProjectedStart: String, + planActive: Boolean, phaseAction: String, phaseRemainingInterpolated: Number, pvAction: String, @@ -61,12 +62,12 @@ export default { return t("minCharge", { soc: this.minSoc }); } - // target charge + // plan if (this.targetTime && !this.targetChargeDisabled) { - if (this.charging) { + if (this.planActive && this.charging) { return t("targetChargeActive"); } - if (this.enabled) { + if (this.planActive && this.enabled) { return t("targetChargeWaitForVehicle"); } if (this.planProjectedStart) {