X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationUtils.ts;h=9eee346630083ee75dc623af9b16c6ff14704d0f;hb=8bea4a18973485e1b98d153c45447841f622b701;hp=582912b0d6a937097bef372150e0d7b212639051;hpb=fec4d204dd05c108fb49312bb7a570d15a4eb4bb;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 582912b0..9eee3466 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -235,20 +235,11 @@ export class ChargingStationUtils { } public static createStationInfoHash(stationInfo: ChargingStationInfo): void { - const previousInfoHash = stationInfo?.infoHash ?? ''; delete stationInfo.infoHash; - const currentInfoHash = crypto + stationInfo.infoHash = crypto .createHash(Constants.DEFAULT_HASH_ALGORITHM) .update(JSON.stringify(stationInfo)) .digest('hex'); - if ( - Utils.isEmptyString(previousInfoHash) || - (!Utils.isEmptyString(previousInfoHash) && currentInfoHash !== previousInfoHash) - ) { - stationInfo.infoHash = currentInfoHash; - } else { - stationInfo.infoHash = previousInfoHash; - } } public static createSerialNumber( @@ -287,7 +278,9 @@ export class ChargingStationUtils { stationInfoDst: ChargingStationInfo = {} as ChargingStationInfo ) { if (!stationInfoSrc || !stationTemplate) { - throw new BaseError('Missing charging station template or info to propagate serial number'); + throw new BaseError( + 'Missing charging station template or existing configuration to propagate serial number' + ); } stationTemplate?.chargePointSerialNumberPrefix && stationInfoSrc?.chargePointSerialNumber ? (stationInfoDst.chargePointSerialNumber = stationInfoSrc.chargePointSerialNumber)