Skip to content

Commit

Permalink
Refactor functions for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett-S-OWB committed Jan 9, 2025
1 parent 5872e07 commit f861b4c
Showing 1 changed file with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,30 @@ const targetSoc = computed<number | undefined>(() => {
mqttStore.chargePointConnectedVehicleInstantChargeLimit(
props.chargePointId,
).value;
if (chargeMode.value === 'scheduled_charging') {
return mqttStore.vehicleScheduledChargingTarget(props.chargePointId).value
?.soc;
} else if (
chargeMode.value === 'instant_charging' &&
instantLimitMode === 'soc'
) {
return mqttStore.chargePointConnectedVehicleInstantChargeLimitSoC(
props.chargePointId,
)?.value;
} else if (chargeMode.value === 'pv_charging') {
return mqttStore.chargePointConnectedVehiclePVChargeMaxSoc(
props.chargePointId,
).value;
} else {
return undefined;
switch (chargeMode.value) {
case 'scheduled_charging':
return mqttStore.vehicleScheduledChargingTarget(props.chargePointId).value
?.soc;
case 'instant_charging':
return instantLimitMode === 'soc'
? mqttStore.chargePointConnectedVehicleInstantChargeLimitSoC(
props.chargePointId,
).value
: undefined;
case 'pv_charging':
return mqttStore.chargePointConnectedVehiclePVChargeMaxSoc(
props.chargePointId,
).value;
default:
return undefined;
}
});
const showSocTargetSlider = computed(() => {
return chargeMode.value === 'stop' || chargeMode.value === 'standby'
? false
: true;
return (
chargeMode.value !== undefined &&
!['stop', 'standby'].includes(chargeMode.value)
);
});
const targetTime = computed(() => {
Expand Down

0 comments on commit f861b4c

Please sign in to comment.