From: Jérôme Benoit Date: Thu, 3 Aug 2023 13:10:45 +0000 (+0200) Subject: fix: tx charging profiles have precedence over the ones on connector 0 X-Git-Tag: v1.2.20~34 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=21ee4dc2dc59410c94c69d11c46ddf07c7298ff1;p=e-mobility-charging-stations-simulator.git fix: tx charging profiles have precedence over the ones on connector 0 Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index dd6bcee1..376199bf 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -517,7 +517,7 @@ export const getAmperageLimitationUnitDivider = (stationInfo: ChargingStationInf /** * Gets the connector cloned charging profiles applying a power limitation - * and sorted by connector id ascending then stack level descending + * and sorted by connector id descending then stack level descending * * @param chargingStation - * @param connectorId - @@ -528,10 +528,10 @@ export const getConnectorChargingProfiles = ( connectorId: number, ) => { return cloneObject( - (chargingStation.getConnectorStatus(0)?.chargingProfiles ?? []) + (chargingStation.getConnectorStatus(connectorId)?.chargingProfiles ?? []) .sort((a, b) => b.stackLevel - a.stackLevel) .concat( - (chargingStation.getConnectorStatus(connectorId)?.chargingProfiles ?? []).sort( + (chargingStation.getConnectorStatus(0)?.chargingProfiles ?? []).sort( (a, b) => b.stackLevel - a.stackLevel, ), ), @@ -735,7 +735,7 @@ interface ChargingProfilesLimit { } /** - * Charging profiles shall already be sorted by connector id ascending then stack level descending + * Charging profiles shall already be sorted by connector id descending then stack level descending * * @param chargingStation - * @param connectorId -