From f8f80fbeb03146e2791ed1d2e3f03b8b33692a3c Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 5 Jun 2023 12:27:38 +0200 Subject: [PATCH] making sure to only take unique funboxes --- backend/src/api/controllers/result.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/api/controllers/result.ts b/backend/src/api/controllers/result.ts index f41ede83f..4cc1d286d 100644 --- a/backend/src/api/controllers/result.ts +++ b/backend/src/api/controllers/result.ts @@ -625,7 +625,8 @@ async function calculateXp( } if (funboxBonusConfiguration > 0) { - const funboxModifier = _.sumBy(funbox.split("#"), (funboxName) => { + const resultFunboxes = _.uniq(funbox.split("#")); + const funboxModifier = _.sumBy(resultFunboxes, (funboxName) => { const funbox = FunboxesMetadata[funboxName as string]; const difficultyLevel = funbox?.difficultyLevel ?? 0; return Math.max(difficultyLevel * funboxBonusConfiguration, 0);