From 0a96409ab6db51ef7b2e6e292216d12c926f7e9c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 2 Aug 2023 18:59:34 +0200 Subject: [PATCH] fix: fix wrong charging profiles resorting at power limitation computation 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 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index 9de54777..63cc0f63 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -734,7 +734,7 @@ interface ChargingProfilesLimit { } /** - * Charging profiles should already be sorted by connector id ascending then stack level descending + * Charging profiles shall already be sorted by connector id ascending then stack level descending * * @param chargingStation - * @param connectorId - @@ -751,12 +751,6 @@ const getLimitFromChargingProfiles = ( const debugLogMsg = `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Matching charging profile found for power limitation: %j`; const currentDate = new Date(); const connectorStatus = chargingStation.getConnectorStatus(connectorId)!; - if (!isArraySorted(chargingProfiles, (a, b) => b.stackLevel - a.stackLevel)) { - logger.warn( - `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Charging profiles are not sorted by stack level. Trying to sort them`, - ); - chargingProfiles.sort((a, b) => b.stackLevel - a.stackLevel); - } for (const chargingProfile of chargingProfiles) { const chargingSchedule = chargingProfile.chargingSchedule; if (connectorStatus?.transactionStarted && isNullOrUndefined(chargingSchedule?.startSchedule)) { -- 2.34.1