From: Jérôme Benoit Date: Mon, 24 Jul 2023 14:38:53 +0000 (+0200) Subject: refactor: cleanup variable namespace X-Git-Tag: v1.2.20~159^2~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=354c3fbee8d01f90e16b851797196c77b7c07bf9;p=e-mobility-charging-stations-simulator.git refactor: cleanup variable namespace Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index b44bf75d..0f2f5217 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1031,11 +1031,14 @@ export class ChargingStation { ); if (interval > 0) { this.reservationExpirationSetInterval = setInterval((): void => { - const dateNow = new Date(); + const currentDate = new Date(); if (this.hasEvses) { for (const evseStatus of this.evses.values()) { for (const connectorStatus of evseStatus.connectors.values()) { - if (connectorStatus.reservation && connectorStatus.reservation.expiryDate < dateNow) { + if ( + connectorStatus.reservation && + connectorStatus.reservation.expiryDate < currentDate + ) { this.removeReservation( connectorStatus.reservation, ReservationTerminationReason.EXPIRED, @@ -1045,7 +1048,10 @@ export class ChargingStation { } } else { for (const connectorStatus of this.connectors.values()) { - if (connectorStatus.reservation && connectorStatus.reservation.expiryDate < dateNow) { + if ( + connectorStatus.reservation && + connectorStatus.reservation.expiryDate < currentDate + ) { this.removeReservation( connectorStatus.reservation, ReservationTerminationReason.EXPIRED,