X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=carousel.js;h=aefe6db81324bc876671b791c1daa3656d439693;hb=38a454bd572510e7ead633f0ff94517dc7001cc6;hp=f3c60145d4b11a9e063cd0ada7e94ae20cafd4ca;hpb=5e3676c0b149c5bc342fedf54ac87a75fbae88dc;p=ultimatescore diff --git a/carousel.js b/carousel.js index f3c6014..aefe6db 100644 --- a/carousel.js +++ b/carousel.js @@ -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]; }