X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FAutomaticTransactionGenerator.ts;h=dddfc045c9a80aba7e56ab3e985727188bbd6f87;hb=c18084e22955bbbe514bb3ecef8818417407608d;hp=6913853b2911b8354784d9799f9d377c8356aa2d;hpb=54544ef1ca864c3a2e07ff020a7b8f0b38a825fd;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 6913853b..dddfc045 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -11,8 +11,8 @@ import logger from '../utils/Logger'; export default class AutomaticTransactionGenerator { public started: boolean; - private chargingStation: ChargingStation; - private connectorsStatus: Map; + private readonly chargingStation: ChargingStation; + private readonly connectorsStatus: Map; constructor(chargingStation: ChargingStation) { this.chargingStation = chargingStation; @@ -40,7 +40,7 @@ export default class AutomaticTransactionGenerator { } private startConnectors(): void { - if (this.connectorsStatus?.size !== 0 && this.connectorsStatus.size !== this.chargingStation.getNumberOfConnectors()) { + if (this.connectorsStatus?.size > 0 && this.connectorsStatus.size !== this.chargingStation.getNumberOfConnectors()) { this.connectorsStatus.clear(); } for (const connectorId of this.chargingStation.connectors.keys()) { @@ -66,8 +66,8 @@ export default class AutomaticTransactionGenerator { this.stopConnector(connectorId); break; } - if (!this.chargingStation.isRegistered()) { - logger.error(this.logPrefix(connectorId) + ' entered in transaction loop while the charging station is not registered'); + if (!this.chargingStation.isInAcceptedState()) { + logger.error(this.logPrefix(connectorId) + ' entered in transaction loop while the charging station is not in accepted state'); this.stopConnector(connectorId); break; }