From: Jérôme Benoit Date: Mon, 8 May 2023 23:25:01 +0000 (+0200) Subject: refactor: cleanup variables namespace X-Git-Tag: v1.2.13~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=791cd51356f38b482d8289e2ab50603aaaadb0af;p=e-mobility-charging-stations-simulator.git refactor: cleanup variables namespace Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index be372de6..37f76911 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -366,15 +366,15 @@ export class Utils { return sortedDataSet[sortedDataSet.length - 1]; } const percentileIndexBase = (percentile / 100) * (sortedDataSet.length - 1); - const percentileIntegerIndex = Math.floor(percentileIndexBase); - if (!Utils.isNullOrUndefined(sortedDataSet[percentileIntegerIndex + 1])) { + const percentileIndexInteger = Math.floor(percentileIndexBase); + if (!Utils.isNullOrUndefined(sortedDataSet[percentileIndexInteger + 1])) { return ( - sortedDataSet[percentileIntegerIndex] + - (percentileIndexBase - percentileIntegerIndex) * - (sortedDataSet[percentileIntegerIndex + 1] - sortedDataSet[percentileIntegerIndex]) + sortedDataSet[percentileIndexInteger] + + (percentileIndexBase - percentileIndexInteger) * + (sortedDataSet[percentileIndexInteger + 1] - sortedDataSet[percentileIndexInteger]) ); } - return sortedDataSet[percentileIntegerIndex]; + return sortedDataSet[percentileIndexInteger]; } public static stdDeviation(dataSet: number[]): number {