X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FHelpers.ts;h=df3d03082ea3053969c386b8e9c39300426c5e39;hb=1feac591544c625c56086abe1f14dbdc706280fb;hp=50b26885bbf999e21e5e92d243475a0a68c55871;hpb=5dc7c990eff43659bd48589cfc5afe09f9ec6664;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index 50b26885..df3d0308 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -57,7 +57,7 @@ import { ACElectricUtils, Constants, DCElectricUtils, - cloneObject, + clone, convertToDate, convertToInt, isArraySorted, @@ -247,14 +247,6 @@ export const checkTemplate = ( logger.error(`${logPrefix} ${errorMsg}`) throw new BaseError(errorMsg) } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - if (isEmptyObject(stationTemplate.AutomaticTransactionGenerator!)) { - stationTemplate.AutomaticTransactionGenerator = Constants.DEFAULT_ATG_CONFIGURATION - logger.warn( - `${logPrefix} Empty automatic transaction generator configuration from template file ${templateFile}, set to default: %j`, - Constants.DEFAULT_ATG_CONFIGURATION - ) - } if (stationTemplate.idTagsFile == null || isEmptyString(stationTemplate.idTagsFile)) { logger.warn( `${logPrefix} Missing id tags file in template file ${templateFile}. That can lead to issues with the Automatic Transaction Generator` @@ -331,7 +323,7 @@ export const buildConnectorsMap = ( const connectorStatus = connectors[connector] const connectorId = convertToInt(connector) checkStationInfoConnectorStatus(connectorId, connectorStatus, logPrefix, templateFile) - connectorsMap.set(connectorId, cloneObject(connectorStatus)) + connectorsMap.set(connectorId, clone(connectorStatus)) } } else { logger.warn( @@ -468,7 +460,7 @@ export const warnTemplateKeysDeprecation = ( export const stationTemplateToStationInfo = ( stationTemplate: ChargingStationTemplate ): ChargingStationInfo => { - stationTemplate = cloneObject(stationTemplate) + stationTemplate = clone(stationTemplate) delete stationTemplate.power delete stationTemplate.powerUnit delete stationTemplate.Connectors @@ -566,7 +558,7 @@ export const getConnectorChargingProfiles = ( chargingStation: ChargingStation, connectorId: number ): ChargingProfile[] => { - return cloneObject( + return clone( (chargingStation.getConnectorStatus(connectorId)?.chargingProfiles ?? []) .sort((a, b) => b.stackLevel - a.stackLevel) .concat(