From: Jérôme Benoit Date: Mon, 5 Sep 2022 08:21:48 +0000 (+0200) Subject: ATG: fix start transaction counting with no authentication X-Git-Tag: v1.1.71~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d9ac47efec22daef116af9fbdb3e7e01685e60fb;p=e-mobility-charging-stations-simulator.git ATG: fix start transaction counting with no authentication Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index d552d8a5..cdef826b 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -309,13 +309,7 @@ export default class AutomaticTransactionGenerator { connectorId, idTag, }); - this.connectorsStatus.get(connectorId).startTransactionRequests++; - if (startResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { - this.connectorsStatus.get(connectorId).acceptedStartTransactionRequests++; - } else { - logger.warn(this.logPrefix(connectorId) + ' start transaction rejected'); - this.connectorsStatus.get(connectorId).rejectedStartTransactionRequests++; - } + this.handleStartTransactionResponse(connectorId, startResponse); PerformanceStatistics.endMeasure(measureId, beginId); return startResponse; } @@ -332,6 +326,7 @@ export default class AutomaticTransactionGenerator { connectorId, idTag, }); + this.handleStartTransactionResponse(connectorId, startResponse); PerformanceStatistics.endMeasure(measureId, beginId); return startResponse; } @@ -382,4 +377,17 @@ export default class AutomaticTransactionGenerator { }:` ); } + + private handleStartTransactionResponse( + connectorId: number, + startResponse: StartTransactionResponse + ): void { + this.connectorsStatus.get(connectorId).startTransactionRequests++; + if (startResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { + this.connectorsStatus.get(connectorId).acceptedStartTransactionRequests++; + } else { + logger.warn(this.logPrefix(connectorId) + ' start transaction rejected'); + this.connectorsStatus.get(connectorId).rejectedStartTransactionRequests++; + } + } }