From: Jérôme Benoit Date: Sun, 11 Feb 2024 16:19:04 +0000 (+0100) Subject: refactor: factor out more charging station options handling code X-Git-Tag: v1.2.36~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1253d60cd246f968e985f6f067204a130b384b72;p=e-mobility-charging-stations-simulator.git refactor: factor out more charging station options handling code Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 6b83b136..3c511804 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -253,11 +253,6 @@ export class ChargingStation extends EventEmitter { this.add() - if (options?.autoStart != null) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - this.stationInfo!.autoStart = options.autoStart - } - if (this.stationInfo?.autoStart === true) { this.start() } diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index f69d86f8..258613a3 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -344,6 +344,9 @@ export const setChargingStationOptions = ( stationInfo.automaticTransactionGeneratorPersistentConfiguration = options.persistentConfiguration } + if (options?.autoStart != null) { + stationInfo.autoStart = options.autoStart + } if (options?.autoRegister != null) { stationInfo.autoRegister = options.autoRegister }