From: Jérôme Benoit Date: Sat, 8 Jun 2024 19:36:07 +0000 (+0200) Subject: fix: avoid to modify stored charging profiles X-Git-Tag: v1.3.5~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a629e6fcfeb952d77da280e69d645b17d94b2e4c;p=e-mobility-charging-stations-simulator.git fix: avoid to modify stored charging profiles Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index 2c264cd5..74b5e2af 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -636,15 +636,14 @@ export const getConnectorChargingProfiles = ( chargingStation: ChargingStation, connectorId: number ): ChargingProfile[] => { - return clone( - (chargingStation.getConnectorStatus(connectorId)?.chargingProfiles ?? []) - .sort((a, b) => b.stackLevel - a.stackLevel) - .concat( - (chargingStation.getConnectorStatus(0)?.chargingProfiles ?? []).sort( - (a, b) => b.stackLevel - a.stackLevel - ) - ) - ) + return (chargingStation.getConnectorStatus(connectorId)?.chargingProfiles ?? []) + .slice() + .sort((a, b) => b.stackLevel - a.stackLevel) + .concat( + (chargingStation.getConnectorStatus(0)?.chargingProfiles ?? []) + .slice() + .sort((a, b) => b.stackLevel - a.stackLevel) + ) } export const getChargingStationConnectorChargingProfilesPowerLimit = (