From 67b07bd7c5b9a510f0357b4a26f2136bff94dbd0 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Wed, 27 Nov 2024 17:50:21 +0530 Subject: [PATCH] fix: consider all delegation strategies (#4) --- src/compute.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compute.ts b/src/compute.ts index 8d75e73..d1efdff 100644 --- a/src/compute.ts +++ b/src/compute.ts @@ -75,9 +75,16 @@ async function getScores( `${SCORE_API_URL}/api/scores` ); + const totalScores = result.reduce((acc, scores) => { + for (const [delegate, score] of Object.entries(scores)) { + acc[delegate] = (acc[delegate] ?? 0) + score; + } + return acc; + }, {}); + scores = { ...scores, - ...result[0] + ...totalScores }; }