]> git.sesse.net Git - ultimatescore/commitdiff
Fix an issue with calculating scores for teams that have not played.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 15 Mar 2018 19:26:53 +0000 (20:26 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 15 Mar 2018 19:26:53 +0000 (20:26 +0100)
carousel.js

index f3c60145d4b11a9e063cd0ada7e94ae20cafd4ca..82027427b53afdf488508fbe239888d31acab625 100644 (file)
@@ -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];
                                        }