]> git.sesse.net Git - ultimatescore/blobdiff - carousel.js
In the spreadsheets listing match results, allow abbreviations for teams.
[ultimatescore] / carousel.js
index ac48db40c81cff50b5eb96ad8c1f08b727042eac..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];
                                        }
@@ -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<br />" + group_name);
+       addheading(carousel, 5, "Current standings<br />" + 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<br />" + covered_days.join('/') + " (all times CET)");
+       addheading(carousel, 3, "Match schedule<br />" + covered_days.join('/') + " (all times CET)");
 
        let teams_to_idx = make_teams_to_idx(teams);
        row_num = 0;