X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=carousel.js;h=aefe6db81324bc876671b791c1daa3656d439693;hb=38a454bd572510e7ead633f0ff94517dc7001cc6;hp=ac48db40c81cff50b5eb96ad8c1f08b727042eac;hpb=6639e908e5a74d691a93edf1a16217911f4e4eb4;p=ultimatescore diff --git a/carousel.js b/carousel.js index ac48db4..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]; } @@ -392,7 +394,7 @@ function display_group_parsed(teams, games, group_name) let carousel = document.getElementById('carousel'); clear_carousel(carousel); - addheading(carousel, 5, "Current standings, Trøndisk 2017
" + group_name); + addheading(carousel, 5, "Current standings
" + group_name); let tr = document.createElement("tr"); tr.className = "subfooter"; addth(tr, "rank", ""); @@ -428,7 +430,7 @@ function display_group_parsed(teams, games, group_name) let footer_tr = document.createElement("tr"); footer_tr.className = "footer"; let td = document.createElement("td"); - td.appendChild(document.createTextNode("www.trondheimfrisbeeklubb.no | #trøndisk")); + td.appendChild(document.createTextNode("Norwegian Ultimate Championships 2018 | #ultimatenm")); td.setAttribute("colspan", "5"); footer_tr.appendChild(td); carousel.appendChild(footer_tr); @@ -542,7 +544,7 @@ function display_stream_schedule_parsed(teams, games, page) { let carousel = document.getElementById('carousel'); clear_carousel(carousel); - addheading(carousel, 3, "Stream schedule, Trøndisk 2017
" + covered_days.join('/') + " (all times CET)"); + addheading(carousel, 3, "Match schedule
" + covered_days.join('/') + " (all times CET)"); let teams_to_idx = make_teams_to_idx(teams); row_num = 0;