X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FStatistics.js;h=5289a5749326c976500bb19987652d691cf2056b;hb=0a60c33c4f6592f6223136704fa4513b68603f2d;hp=edbec26221680267b35122e5a40c2a84ab1d6d6d;hpb=2e6f5966ecbefada47d60b1b53d21fe49be439a5;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Statistics.js b/src/utils/Statistics.js index edbec262..5289a574 100644 --- a/src/utils/Statistics.js +++ b/src/utils/Statistics.js @@ -52,10 +52,10 @@ class Statistics { if (currentStatistics) { // Update current statistics timers - currentStatistics.countTime = (currentStatistics.countTime ? currentStatistics.countTime + 1 : 1); - currentStatistics.minTime = (currentStatistics.minTime ? (currentStatistics.minTime > duration ? duration : currentStatistics.minTime) : duration); - currentStatistics.maxTime = (currentStatistics.maxTime ? (currentStatistics.maxTime < duration ? duration : currentStatistics.maxTime) : duration); - currentStatistics.totalTime = (currentStatistics.totalTime ? currentStatistics.totalTime + duration : duration); + currentStatistics.countTime = currentStatistics.countTime ? currentStatistics.countTime + 1 : 1; + currentStatistics.minTime = currentStatistics.minTime ? (currentStatistics.minTime > duration ? duration : currentStatistics.minTime) : duration; + currentStatistics.maxTime = currentStatistics.maxTime ? (currentStatistics.maxTime < duration ? duration : currentStatistics.maxTime) : duration; + currentStatistics.totalTime = currentStatistics.totalTime ? currentStatistics.totalTime + duration : duration; currentStatistics.avgTime = currentStatistics.totalTime / currentStatistics.countTime; } } @@ -70,11 +70,11 @@ class Statistics { } _displayInterval() { - if (Configuration.getStatisticsDisplayInterval() !== 0) { - logger.info(this._basicFormatLog() + ' displayed every ' + Configuration.getStatisticsDisplayInterval() + 's'); + if (Configuration.getStatisticsDisplayInterval() > 0) { setInterval(() => { this._display(); }, Configuration.getStatisticsDisplayInterval() * 1000); + logger.info(this._basicFormatLog() + ' displayed every ' + Configuration.getStatisticsDisplayInterval() + 's'); } }