From d17e7a8533b76db43d7fea9c61bf4fc6c5d62427 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 15 Mar 2018 20:26:53 +0100 Subject: [PATCH] Fix an issue with calculating scores for teams that have not played. --- carousel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]; } -- 2.39.2