Fix: hide battery capacity when unknown
This commit is contained in:
parent
a1cec45c93
commit
b97850afd0
1 changed files with 18 additions and 16 deletions
|
|
@ -298,23 +298,25 @@ export default {
|
|||
if (!Array.isArray(this.battery)) {
|
||||
return;
|
||||
}
|
||||
return this.battery.map(({ soc, capacity }) => {
|
||||
const multipleBatteries = this.battery.length > 1;
|
||||
const energy = this.fmtKWh(
|
||||
(capacity / 100) * soc * 1e3,
|
||||
true,
|
||||
!multipleBatteries,
|
||||
1
|
||||
);
|
||||
const total = this.fmtKWh(capacity * 1e3, true, true, 1);
|
||||
const name = multipleBatteries ? "↳ " : "";
|
||||
const formattedSoc = multipleBatteries ? ` (${this.fmtSoc(soc)})` : "";
|
||||
const formattedEnergy = this.$t("batterySettings.capacity", {
|
||||
energy,
|
||||
total,
|
||||
return this.battery
|
||||
.filter(({ capacity }) => capacity > 0)
|
||||
.map(({ soc, capacity }) => {
|
||||
const multipleBatteries = this.battery.length > 1;
|
||||
const energy = this.fmtKWh(
|
||||
(capacity / 100) * soc * 1e3,
|
||||
true,
|
||||
!multipleBatteries,
|
||||
1
|
||||
);
|
||||
const total = this.fmtKWh(capacity * 1e3, true, true, 1);
|
||||
const name = multipleBatteries ? "↳ " : "";
|
||||
const formattedSoc = multipleBatteries ? ` (${this.fmtSoc(soc)})` : "";
|
||||
const formattedEnergy = this.$t("batterySettings.capacity", {
|
||||
energy,
|
||||
total,
|
||||
});
|
||||
return `${name}${formattedEnergy}${formattedSoc}`;
|
||||
});
|
||||
return `${name}${formattedEnergy}${formattedSoc}`;
|
||||
});
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue