X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=carousel.js;h=25872316449b0c8b7c3bc4347880e1aef04283a7;hb=refs%2Fheads%2Fmaster;hp=04e9e731a0e47f53cdaa3aebf6618c25f0d7d861;hpb=51c44cca98544a61efa0ac9ca201d1779e47491c;p=ultimatescore diff --git a/carousel.js b/carousel.js index 04e9e73..2587231 100644 --- a/carousel.js +++ b/carousel.js @@ -369,6 +369,7 @@ function parse_teams_from_spreadsheet(response) { "mediumname": response.values[i][1], "shortname": response.values[i][2], //"tags": response.values[i][3], + "seeding": parseInt(response.values[i][3]), "ngames": 0, "nplayed": 0, "gd": 0, @@ -538,7 +539,7 @@ function filter_teams(teams, response) function filter_teams_by_group(teams, groups, group) { return teams.filter(function(team) { - return groups[group].indexOf(team.shortname) != -1; + return groups[group].indexOf(team.shortname) != -1 || groups[group].indexOf(team.mediumname) != -1; }); } @@ -671,6 +672,15 @@ function find_num_pages(games) { return Math.ceil((games.length - start_idx) / max_list_len); } +function get_mediumname(name, teams, teams_to_idx) +{ + if (teams_to_idx[name] === undefined) { + return name.replace(/^W /, 'Winner ').replace(/^L /, 'Loser '); + } else { + return teams[teams_to_idx[name]].mediumname; + } +} + function display_stream_schedule_parsed(teams, games, page) { document.getElementById('entire-bug').style.display = 'none'; @@ -704,8 +714,8 @@ function display_stream_schedule_parsed(teams, games, page) { for (let i = start_idx; i < games.length && row_num < max_list_len; ++i) { let tr = document.createElement("tr"); - let name1 = teams[teams_to_idx[games[i].name1]].mediumname; - let name2 = teams[teams_to_idx[games[i].name2]].mediumname; + let name1 = get_mediumname(games[i].name1, teams, teams_to_idx); + let name2 = get_mediumname(games[i].name2, teams, teams_to_idx); addtd(tr, "matchup", name1 + "–" + name2); addtd(tr, "group", games[i].group_name);