From: Jérôme Benoit Date: Thu, 16 Feb 2023 09:25:27 +0000 (+0100) Subject: fix(simulator): init statistic counters without possibly overriding the X-Git-Tag: v1.1.95~44 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=71910904d1b0cefc874e39054d72f0c2dd8385bd;p=e-mobility-charging-stations-simulator.git fix(simulator): init statistic counters without possibly overriding the initial value Signed-off-by: Jérôme Benoit --- diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index 909f6345..69829ff1 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -74,10 +74,10 @@ export class PerformanceStatistics { ) { this.statistics.statisticsData.get(command).countRequest++; } else { - this.statistics.statisticsData.set( - command, - Object.assign({ countRequest: 1 }, this.statistics.statisticsData.get(command)) - ); + this.statistics.statisticsData.set(command, { + ...this.statistics.statisticsData.get(command), + countRequest: 1, + }); } break; case MessageType.CALL_RESULT_MESSAGE: @@ -87,10 +87,10 @@ export class PerformanceStatistics { ) { this.statistics.statisticsData.get(command).countResponse++; } else { - this.statistics.statisticsData.set( - command, - Object.assign({ countResponse: 1 }, this.statistics.statisticsData.get(command)) - ); + this.statistics.statisticsData.set(command, { + ...this.statistics.statisticsData.get(command), + countResponse: 1, + }); } break; case MessageType.CALL_ERROR_MESSAGE: @@ -100,10 +100,10 @@ export class PerformanceStatistics { ) { this.statistics.statisticsData.get(command).countError++; } else { - this.statistics.statisticsData.set( - command, - Object.assign({ countError: 1 }, this.statistics.statisticsData.get(command)) - ); + this.statistics.statisticsData.set(command, { + ...this.statistics.statisticsData.get(command), + countError: 1, + }); } break; default: