From a4af0eb89810b8f440e9657c07417117078a2c1b Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Thu, 15 Jul 2021 01:08:24 +1200 Subject: [PATCH] Update Arcade.js --- processors/games/Arcade.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/processors/games/Arcade.js b/processors/games/Arcade.js index 2d1eb689..af7c805d 100644 --- a/processors/games/Arcade.js +++ b/processors/games/Arcade.js @@ -145,18 +145,23 @@ module.exports = ({ best_round: best_round_zombies, }, }; - // Totals - let wins = 0; - let kills = 0; - Object.keys(modes).forEach((key) => { - const mode = modes[key]; - if ('wins' in mode) wins += mode.wins; - if ('kills' in mode) kills += mode.kills; - }); + + let totalWins = 0; + let totalKills = 0; + + for (const { wins, kills } of Object.values(modes)) { + if (wins) { + totalWins += wins; + } + if (kills) { + totalKills += kills; + } + } + return ({ coins, - wins, - kills, + wins: totalWins, + kills: totalKills, modes, }); };