From: Steinar H. Gunderson Date: Thu, 12 Mar 2020 00:06:07 +0000 (+0100) Subject: Parametrize slightly better in the carousel. X-Git-Url: https://git.sesse.net/?p=ultimatescore;a=commitdiff_plain;h=5ab0b678d22a4afe246d8c446f29fdc957719501 Parametrize slightly better in the carousel. --- diff --git a/carousel.js b/carousel.js index 0dda475..db36d79 100644 --- a/carousel.js +++ b/carousel.js @@ -717,7 +717,14 @@ function showschedule(page) { let teams = []; let games = []; - let num_left = 5; + let groups_to_get = [ + 'Group A', + 'Group B', + 'Group C', + 'Playoffs 9th-13th', + 'Playoffs' + ]; + let num_left = groups_to_get.length; let cb = function(response, group_name) { teams = teams.concat(parse_teams_from_spreadsheet(response)); @@ -727,11 +734,9 @@ function showschedule(page) } }; - get_group('Group A', cb); - get_group('Group B', cb); - get_group('Group C', cb); - get_group('Playoffs', cb); - get_group('Playoffs 9th-13th', cb); + for (const group of groups_to_get) { + get_group(group, cb); + } }; function do_series(series) @@ -753,7 +758,14 @@ function showcarousel() let games_per_group = []; let combined_teams = []; let combined_games = []; - let num_left = 5; + let groups_to_get = [ + 'Group A', + 'Group B', + 'Group C', + 'Playoffs 9th-13th', + 'Playoffs' + ]; + let num_left = groups_to_get.length; let cb = function(response, group_name) { let teams = parse_teams_from_spreadsheet(response); @@ -785,11 +797,9 @@ function showcarousel() } }; - get_group('Group A', cb); - get_group('Group B', cb); - get_group('Group C', cb); - get_group('Playoffs 9th-13th', cb); - get_group('Playoffs', cb); + for (const group of groups_to_get) { + get_group(group, cb); + } }; function stopcarousel()