refactor: cleanup reservation code
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 5 Jun 2023 19:14:57 +0000 (21:14 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 5 Jun 2023 19:14:57 +0000 (21:14 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 24f946828b03d4495944ae992dba324210d64d5c..0101e26e11fd6f355189ea73e15a6d59a5287ee0 100644 (file)
@@ -935,8 +935,7 @@ export class ChargingStation {
     if (exists) {
       await this.removeReservation(reservationFound);
     }
-    const connectorStatus = this.getConnectorStatus(reservation.connectorId);
-    connectorStatus.reservation = reservation;
+    this.getConnectorStatus(reservation.connectorId).reservation = reservation;
     await OCPPServiceUtils.sendAndSetConnectorStatus(
       this,
       reservation.connectorId,
@@ -968,6 +967,8 @@ export class ChargingStation {
         );
         delete connector.reservation;
         break;
+      default:
+        break;
     }
   }