fix: remove transaction charging profiles at stop transaction
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 3 Aug 2023 13:39:02 +0000 (15:39 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 3 Aug 2023 13:39:02 +0000 (15:39 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/Helpers.ts

index 376199bff0b8bedfad1804ba868934fe05b82d5d..0384da3e3026f0f0ce6b006f2b2a640183a7d8a9 100644 (file)
@@ -339,6 +339,11 @@ export const initializeConnectorsMapStatus = (
 };
 
 export const resetConnectorStatus = (connectorStatus: ConnectorStatus): void => {
+  connectorStatus.chargingProfiles = isNotEmptyArray(connectorStatus.chargingProfiles)
+    ? connectorStatus.chargingProfiles?.filter(
+        (chargingProfile) => chargingProfile.transactionId !== connectorStatus?.transactionId,
+      )
+    : [];
   connectorStatus.idTagLocalAuthorized = false;
   connectorStatus.idTagAuthorized = false;
   connectorStatus.transactionRemoteStarted = false;