refactor(simulator): remove unneeded intermediate variable in firmware
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 3 Feb 2023 13:46:07 +0000 (14:46 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 3 Feb 2023 13:46:07 +0000 (14:46 +0100)
     upgrade simulation code

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 54b3afab565f348d7a2577a1d76d181c504b32aa..0de7ab93e822eadae107c678d46f2269ed58c34f 100644 (file)
@@ -1040,7 +1040,6 @@ export default class ChargingStation {
       !Utils.isEmptyString(this.stationInfo.firmwareVersion) &&
       !Utils.isEmptyString(this.stationInfo.firmwareVersionPattern)
     ) {
-      const versionStep = this.stationInfo.firmwareUpgrade?.versionUpgrade?.step ?? 1;
       const patternGroup: number | undefined =
         this.stationInfo.firmwareUpgrade?.versionUpgrade?.patternGroup ??
         this.stationInfo.firmwareVersion?.split('.').length;
@@ -1049,7 +1048,8 @@ export default class ChargingStation {
         ?.slice(1, patternGroup + 1);
       const patchLevelIndex = match.length - 1;
       match[patchLevelIndex] = (
-        Utils.convertToInt(match[patchLevelIndex]) + versionStep
+        Utils.convertToInt(match[patchLevelIndex]) +
+        this.stationInfo.firmwareUpgrade?.versionUpgrade?.step
       ).toString();
       this.stationInfo.firmwareVersion = match?.join('.');
     }