From 7632e56dc03f210fba965b2fc2cc75ac1f6d45d2 Mon Sep 17 00:00:00 2001 From: italo jose Date: Wed, 15 May 2024 19:14:24 -0300 Subject: [PATCH] worker: comparing sortKey with aggregated[k] instead k. Issue #16 --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 45b022d..bb8ad44 100644 --- a/worker.js +++ b/worker.js @@ -108,7 +108,7 @@ function findMedian(aggregated) { // Select median const sortKey = aggregated.sortKey for (const k of Object.keys(aggregated)) { - if (k === sortKey) continue + if (aggregated[k] === sortKey) continue aggregated[k].sort((a, b) => a[sortKey] > b[sortKey]) const middleIndex = Math.floor(aggregated[k].length / 2); results.push({