Skip to content

Commit

Permalink
fix: avoid to modify stored charging profiles
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
jerome-benoit committed Jun 8, 2024
1 parent 65099c1 commit a629e6f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/charging-station/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,15 +636,14 @@ export const getConnectorChargingProfiles = (
chargingStation: ChargingStation,
connectorId: number
): ChargingProfile[] => {
return clone<ChargingProfile[]>(
(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 = (
Expand Down

0 comments on commit a629e6f

Please sign in to comment.