From 158079940f579f971e1eabe6c6073d8fd3174b1d Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Jul 2023 14:59:19 +0100 Subject: [PATCH] Set 0 points to packet loss AIM score in case of connection error --- src/Results/ScoresCalculations.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Results/ScoresCalculations.js b/src/Results/ScoresCalculations.js index b1ab037..19719d5 100644 --- a/src/Results/ScoresCalculations.js +++ b/src/Results/ScoresCalculations.js @@ -13,6 +13,10 @@ const customResultTypes = { : undefined }; +const defaultPoints = { + packetLoss: 0 +}; + class ScoresCalculations { constructor(config) { this.#config = config; @@ -26,7 +30,9 @@ class ScoresCalculations { ? customResultTypes[type](measurements) : measurements[type]; return val === undefined - ? {} + ? defaultPoints.hasOwnProperty(type) + ? { [type]: defaultPoints[type] } + : {} : { [type]: val === undefined ? 0 : +fn(val) };