From fbba8d92151fda665aab9b7c0e06aebe45e3a6be Mon Sep 17 00:00:00 2001 From: helloitsian <15301476+helloitsian@users.noreply.github.com> Date: Wed, 8 Jun 2022 23:51:34 -0500 Subject: [PATCH] fixed bug with teamToPlayerArray function --- teamSorter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/teamSorter.js b/teamSorter.js index f528f91..18ac40e 100644 --- a/teamSorter.js +++ b/teamSorter.js @@ -296,7 +296,8 @@ const calcTeamValue = (team) => { const teamToPlayerArray = (team) => { return Object.entries(team).map(([role, player]) => { - player.assignedRole = role; + if (player) + player.assignedRole = role; return player; }); }; @@ -336,6 +337,7 @@ const balanceTeamsByRank = (teamOne, teamTwo) => { bot: null, support: null, }; + console.log(teamOne, teamTwo); const teamOnePlayers = teamToPlayerArray(teamOne); const teamTwoPlayers = teamToPlayerArray(teamTwo); const mergedPlayers = [...teamOnePlayers, ...teamTwoPlayers];