fix: fix TxProfile removal with transaction id defined at Tx stop
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 9 Jun 2024 14:00:35 +0000 (16:00 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 9 Jun 2024 14:00:35 +0000 (16:00 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/Helpers.ts

index 01c7f2921080f485f92b87af14dbd44882fcaf50..93df1dedd9da579e2991bca552752745545f0506 100644 (file)
@@ -420,10 +420,11 @@ export const resetConnectorStatus = (connectorStatus: ConnectorStatus | undefine
   if (isNotEmptyArray(connectorStatus.chargingProfiles)) {
     connectorStatus.chargingProfiles = connectorStatus.chargingProfiles.filter(
       chargingProfile =>
-        chargingProfile.chargingProfilePurpose !== ChargingProfilePurposeType.TX_PROFILE ||
-        (chargingProfile.transactionId != null &&
+        (chargingProfile.chargingProfilePurpose === ChargingProfilePurposeType.TX_PROFILE &&
+          chargingProfile.transactionId != null &&
           connectorStatus.transactionId != null &&
-          chargingProfile.transactionId !== connectorStatus.transactionId)
+          chargingProfile.transactionId !== connectorStatus.transactionId) ||
+        chargingProfile.chargingProfilePurpose !== ChargingProfilePurposeType.TX_PROFILE
     )
   }
   resetAuthorizeConnectorStatus(connectorStatus)