Improve code readability
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 22 Nov 2021 17:41:14 +0000 (18:41 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 22 Nov 2021 17:41:14 +0000 (18:41 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/performance/PerformanceStatistics.ts

index f9be1922f3ef87e98c1af83a39565933b2a5d698..5df92f9049fae5398bf2dbf400b3bc6886cba436 100644 (file)
@@ -170,11 +170,19 @@ export default class PerformanceStatistics {
     }
     // Update current statistics
     this.statistics.updatedAt = new Date();
-    this.statistics.statisticsData.get(entryName).countTimeMeasurement = this.statistics.statisticsData.get(entryName)?.countTimeMeasurement ? this.statistics.statisticsData.get(entryName).countTimeMeasurement + 1 : 1;
+    this.statistics.statisticsData.get(entryName).countTimeMeasurement = this.statistics.statisticsData.get(entryName)?.countTimeMeasurement
+      ? this.statistics.statisticsData.get(entryName).countTimeMeasurement + 1
+      : 1;
     this.statistics.statisticsData.get(entryName).currentTimeMeasurement = entry.duration;
-    this.statistics.statisticsData.get(entryName).minTimeMeasurement = this.statistics.statisticsData.get(entryName)?.minTimeMeasurement ? (this.statistics.statisticsData.get(entryName).minTimeMeasurement > entry.duration ? entry.duration : this.statistics.statisticsData.get(entryName).minTimeMeasurement) : entry.duration;
-    this.statistics.statisticsData.get(entryName).maxTimeMeasurement = this.statistics.statisticsData.get(entryName)?.maxTimeMeasurement ? (this.statistics.statisticsData.get(entryName).maxTimeMeasurement < entry.duration ? entry.duration : this.statistics.statisticsData.get(entryName).maxTimeMeasurement) : entry.duration;
-    this.statistics.statisticsData.get(entryName).totalTimeMeasurement = this.statistics.statisticsData.get(entryName)?.totalTimeMeasurement ? this.statistics.statisticsData.get(entryName).totalTimeMeasurement + entry.duration : entry.duration;
+    this.statistics.statisticsData.get(entryName).minTimeMeasurement = this.statistics.statisticsData.get(entryName)?.minTimeMeasurement
+      ? (this.statistics.statisticsData.get(entryName).minTimeMeasurement > entry.duration ? entry.duration : this.statistics.statisticsData.get(entryName).minTimeMeasurement)
+      : entry.duration;
+    this.statistics.statisticsData.get(entryName).maxTimeMeasurement = this.statistics.statisticsData.get(entryName)?.maxTimeMeasurement
+      ? (this.statistics.statisticsData.get(entryName).maxTimeMeasurement < entry.duration ? entry.duration : this.statistics.statisticsData.get(entryName).maxTimeMeasurement)
+      : entry.duration;
+    this.statistics.statisticsData.get(entryName).totalTimeMeasurement = this.statistics.statisticsData.get(entryName)?.totalTimeMeasurement
+      ? this.statistics.statisticsData.get(entryName).totalTimeMeasurement + entry.duration
+      : entry.duration;
     this.statistics.statisticsData.get(entryName).avgTimeMeasurement = this.statistics.statisticsData.get(entryName).totalTimeMeasurement / this.statistics.statisticsData.get(entryName).countTimeMeasurement;
     Array.isArray(this.statistics.statisticsData.get(entryName).timeMeasurementSeries)
       ? this.statistics.statisticsData.get(entryName).timeMeasurementSeries.push({ timestamp: entry.startTime, value: entry.duration })