From: Steinar H. Gunderson Date: Thu, 15 Mar 2018 19:26:53 +0000 (+0100) Subject: Fix an issue with calculating scores for teams that have not played. X-Git-Url: https://git.sesse.net/?p=ultimatescore;a=commitdiff_plain;h=d17e7a8533b76db43d7fea9c61bf4fc6c5d62427 Fix an issue with calculating scores for teams that have not played. --- diff --git a/carousel.js b/carousel.js index f3c6014..8202742 100644 --- a/carousel.js +++ b/carousel.js @@ -235,7 +235,7 @@ function rank(games, teams, start_rank, tiebreakers) { // See if the two teams have both played a third team k. for (let k in results_i) { if (!results_i.hasOwnProperty(k)) continue; - if (results_j[k] !== undefined) { + if (results_j !== undefined && results_j[k] !== undefined) { gd_i += results_i[k][0] - results_i[k][1]; gd_j += results_j[k][0] - results_j[k][1]; } @@ -275,7 +275,7 @@ function rank(games, teams, start_rank, tiebreakers) { // See if the two teams have both played a third team k. for (let k in results_i) { if (!results_i.hasOwnProperty(k)) continue; - if (results_j[k] !== undefined) { + if (results_j !== undefined && results_j[k] !== undefined) { goals_i += results_i[k][0]; goals_j += results_j[k][0]; }