]> git.sesse.net Git - ultimatescore/commitdiff
Parametrize slightly better in the carousel.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 12 Mar 2020 00:06:07 +0000 (01:06 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 12 Mar 2020 00:06:07 +0000 (01:06 +0100)
carousel.js

index 0dda4750cfa8f57b2a5809ba4ab03bb1f2b58ad6..db36d790fface8ea2e40baea98a471b159d1c354 100644 (file)
@@ -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()