From: Jérôme Benoit Date: Sat, 10 Feb 2024 00:19:08 +0000 (+0100) Subject: refactor: cleanup default stationInfo handling X-Git-Tag: v1.2.36~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2969a5d77e88ced7179a275c2deca9e7a36bee4a;p=e-mobility-charging-stations-simulator.git refactor: cleanup default stationInfo handling Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index aca295df..a57f3eaa 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1196,7 +1196,8 @@ export class ChargingStation extends EventEmitter { } private getStationInfoFromFile ( - stationInfoPersistentConfiguration?: boolean + stationInfoPersistentConfiguration: boolean | undefined = Constants.DEFAULT_STATION_INFO + .stationInfoPersistentConfiguration ): ChargingStationInfo | undefined { let stationInfo: ChargingStationInfo | undefined if (stationInfoPersistentConfiguration === true) { @@ -1221,7 +1222,7 @@ export class ChargingStation extends EventEmitter { (stationInfoFromTemplate.stationInfoPersistentConfiguration = stationInfoPersistentConfiguration) const stationInfoFromFile = this.getStationInfoFromFile( - stationInfoFromTemplate.stationInfoPersistentConfiguration ?? true + stationInfoFromTemplate.stationInfoPersistentConfiguration ) // Priority: // 1. charging station info from template @@ -1802,7 +1803,8 @@ export class ChargingStation extends EventEmitter { } private getOcppConfiguration ( - ocppPersistentConfiguration: boolean | undefined = this.stationInfo?.ocppPersistentConfiguration + ocppPersistentConfiguration: boolean | undefined = Constants.DEFAULT_STATION_INFO + .ocppPersistentConfiguration ): ChargingStationOcppConfiguration | undefined { let ocppConfiguration: ChargingStationOcppConfiguration | undefined = this.getOcppConfigurationFromFile(ocppPersistentConfiguration)