X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=carousel.js;h=3d8d20f03220005760af088b40819a138df13981;hb=f7bfc5011e5c9122235b14fc4133591ffe671173;hp=dbf1e1600e802066bbc5999bf16371bf45cfb723;hpb=fed10ae88ec2902742be3f2d35d40e4bca9c5942;p=ultimatescore diff --git a/carousel.js b/carousel.js index dbf1e16..3d8d20f 100644 --- a/carousel.js +++ b/carousel.js @@ -187,7 +187,8 @@ rank = function(games, teams, start_rank, tiebreakers) { for (i = 0; i < games.length; ++i) { var idx1 = teams_to_idx[games[i].name1]; var idx2 = teams_to_idx[games[i].name2]; - if (idx1 !== undefined && idx2 !== undefined) { + if (idx1 !== undefined && idx2 !== undefined && + !isNaN(games[i].score1) && isNaN(games[i].score2)) { teams[idx1].h2h_gd += games[i].score1; teams[idx1].h2h_gd -= games[i].score2; teams[idx2].h2h_gd += games[i].score2; @@ -261,13 +262,17 @@ parse_games_from_spreadsheet = function(response, group_name, include_unplayed) for ( ; response.values[i] !== undefined && response.values[i].length >= 1; ++i) { if ((response.values[i][2] && response.values[i][3]) || include_unplayed) { + var real_group_name = response.values[i][8]; + if (real_group_name === undefined) { + real_group_name = group_name; + } games.push({ "name1": response.values[i][0], "name2": response.values[i][1], "score1": parseInt(response.values[i][2]), "score2": parseInt(response.values[i][3]), "streamtime": response.values[i][7], - "group_name": group_name + "group_name": real_group_name }); } } @@ -288,6 +293,7 @@ var display_group_parsed = function(teams, games, group_name) var idx1 = teams_to_idx[games[i].name1]; var idx2 = teams_to_idx[games[i].name2]; if (games[i].score1 === undefined || games[i].score2 === undefined || + isNaN(games[i].score1) || isNaN(games[i].score2) || idx1 === undefined || idx2 === undefined || games[i].score1 == games[i].score2) { continue; @@ -408,7 +414,7 @@ var display_stream_schedule_parsed = function(teams, games) { // Pick out a reasonable place to start the list. We'll show the last // completed match and start from there. - var max_list_len = 7; + var max_list_len = 8; var start_idx = games.length - 1; for (var i = 0; i < games.length; ++i) { if (isNaN(games[i].score1) || isNaN(games[i].score2) && @@ -478,7 +484,7 @@ var showschedule = function() { var teams = []; var games = []; - var num_left = 5; + var num_left = 3; var cb = function(response, group_name) { teams = teams.concat(parse_teams_from_spreadsheet(response)); @@ -490,9 +496,7 @@ var showschedule = function() get_group('Group A', cb); get_group('Group B', cb); - get_group('Semifinals', cb); - get_group('Bronze final', cb); - get_group('Final', cb); + get_group('Playoffs', cb); }; var do_series = function(series) @@ -514,7 +518,7 @@ var showcarousel = function() var games_per_group = []; var combined_teams = []; var combined_games = []; - var num_left = 5; + var num_left = 3; var cb = function(response, group_name) { var teams = parse_teams_from_spreadsheet(response); @@ -538,15 +542,13 @@ var showcarousel = function() get_group('Group A', cb); get_group('Group B', cb); - get_group('Semifinals', cb); - get_group('Bronze final', cb); - get_group('Final', cb); + get_group('Playoffs', cb); }; var stopcarousel = function() { - hidetable(); if (carousel_timeout !== null) { + hidetable(); clearTimeout(carousel_timeout); carousel_timeout = null; }