]> git.sesse.net Git - ultimatescore/commitdiff
Fix a schedule issue when W B1/C2 etc. is not on the list.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 29 Sep 2021 17:46:10 +0000 (19:46 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 29 Sep 2021 17:46:10 +0000 (19:46 +0200)
carousel.js

index 04e9e731a0e47f53cdaa3aebf6618c25f0d7d861..1e7d58851a064e449182c5bd09a70ae9c7b4d902 100644 (file)
@@ -671,6 +671,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 +713,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);