Code cleanups
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 17 May 2021 22:20:36 +0000 (00:20 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 17 May 2021 22:20:36 +0000 (00:20 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/utils/PerformanceStatistics.ts

index b06f1c74811dbc33a5a54ee37d6dbbae7bdfae7d..e9d2d2e9dc18477b70769f9d79682ea8b51f4700 100644 (file)
@@ -50,7 +50,7 @@ export default class OCPP16ResponseService extends OCPPResponseService {
       return;
     }
 
-    if (payload?.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
+    if (payload.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
       this.chargingStation.getConnector(connectorId).transactionStarted = true;
       this.chargingStation.getConnector(connectorId).transactionId = payload.transactionId;
       this.chargingStation.getConnector(connectorId).idTag = requestPayload.idTag;
index 513c4ff17ec7aad82b95f779603849a8a28f109d..bcd0b71f69888318b1e5dfd35a2e2fc67757af2e 100644 (file)
@@ -112,13 +112,13 @@ export default class PerformanceStatistics {
 
   private addPerformanceTimer(command: RequestCommand | IncomingRequestCommand, duration: number): void {
     // Map to proper command name
-    const MAPCOMMAND = {
+    const MAP_COMMAND = {
       sendMeterValues: RequestCommand.METER_VALUES,
       startTransaction: RequestCommand.START_TRANSACTION,
       stopTransaction: RequestCommand.STOP_TRANSACTION,
     };
-    if (MAPCOMMAND[command]) {
-      command = MAPCOMMAND[command] as RequestCommand | IncomingRequestCommand;
+    if (MAP_COMMAND[command]) {
+      command = MAP_COMMAND[command] as RequestCommand | IncomingRequestCommand;
     }
     // Initialize command statistics
     if (!this.commandsStatistics.commandsStatisticsData[command]) {