]> git.sesse.net Git - ultimatescore/blobdiff - carousel.js
In the spreadsheets listing match results, allow abbreviations for teams.
[ultimatescore] / carousel.js
index f3c60145d4b11a9e063cd0ada7e94ae20cafd4ca..aefe6db81324bc876671b791c1daa3656d439693 100644 (file)
@@ -69,6 +69,8 @@ function make_teams_to_idx(teams)
        let teams_to_idx = [];
        for (let i = 0; i < teams.length; i++) {
                teams_to_idx[teams[i].name] = i;
+               teams_to_idx[teams[i].mediumname] = i;
+               teams_to_idx[teams[i].shortname] = i;
        }
        return teams_to_idx;
 }
@@ -235,7 +237,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 +277,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];
                                        }