From a629e6fcfeb952d77da280e69d645b17d94b2e4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 8 Jun 2024 21:36:07 +0200 Subject: [PATCH] fix: avoid to modify stored charging profiles MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/Helpers.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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 = ( -- 2.34.1