let cols = config['score_sheet_cols'];
apply_games_to_teams(games, teams, group_name);
+ teams.sort(function(a, b) { return a.seeding - b.seeding });
// Write the points total to the unsorted columns.
if (config['point_total_start_row'] !== null) {
third_groups = ranked;
} else {
for (let i = 0; i < groups_to_calc.length; ++i) {
- if (third_groups[i].group_idx !== ranked[i].group_idx) {
+ if (third_groups[i].group_idx !== ranked[i].group_idx || // Different from a previous simulation.
+ (i < (third_groups.length - 1) && ranked[i].rank === ranked[i + 1].rank) || // Disallow ties.
+ (i > 0 && ranked[i].rank === ranked[i - 1].rank)) { // Disallow ties.
third_groups[i].group_idx = null;
}
}
}
}
+ // These are pretty hard-coded, but that's probably fine. Must come after we've concretized X, Y, etc.
+ for (const group_name of real_group_names) {
+ let teams = filter_teams_by_group(all_teams, groups, 'Group ' + group_name);
+ if (teams.length >= 5) {
+ for (const other_group_name of real_group_names) {
+ replacements.push([ group_name + other_group_name + '5', group_name + '5' ]);
+ }
+ for (const other_group_name of pseudo_group_names) {
+ replacements.push([ group_name + other_group_name + '5', group_name + '5' ]);
+ }
+ } else { // Perhaps a bit overkill.
+ for (const other_group_name of real_group_names) {
+ replacements.push([ group_name + other_group_name + '5', other_group_name + '5' ]);
+ }
+ for (const other_group_name of pseudo_group_names) {
+ replacements.push([ group_name + other_group_name + '5', other_group_name + '5' ]);
+ }
+ }
+ }
+
for (let group_idx = 0; group_idx < groups_to_calc.length; ++group_idx) {
for (let i = 0; i < teams[group_idx].length; ++i) {
if (teams[group_idx][i].simulated_rank !== null) {
return str;
}
-function fill_playoff(all_teams, groups, replacements, teams) {
+function fill_playoff(all_teams, groups, replacements) {
let team_expansions = {};
for (const team of all_teams) {
team_expansions[team.name] = team_expansions[team.mediumname] = team_expansions[team.shortname] =
get_all_group_games(all_teams, groups, function(group_games) {
// NOTE: filter_teams_by_group will be delayed by one cycle
// after W P1 etc. becomes determined for the first time.
+ // Note that this requires the Groups sheet to pick out
+ // the right teams from the group matches in the Results sheet!
let teams_l1 = filter_teams_by_group(all_teams, groups, 'Playoffs 9th–11th');
let teams_l2 = filter_teams_by_group(all_teams, groups, 'Playoffs 12th–14th');
publish_group_rank(teams_l1, group_games, 'Playoffs 9th–11th');
publish_group_rank(teams_c, games, 'Group C');
let replacements = montecarlo(teams, groups, games, ['Group A', 'Group B', 'Group C']);
- fill_playoff(teams, groups, replacements, [teams_a, teams_b, teams_c]);
+ fill_playoff(teams, groups, replacements);
});
});
});
function get_all_playoff_games(teams, groups, group_games, cb) {
let replacements = montecarlo(teams, groups, group_games, ['Group A', 'Group B', 'Group C']);
+ fill_playoff(teams, groups, replacements); // To get the replacements.
let games = ultimateconfig['playoff_games'];
get_results('Results', function(response) {
let playoff_games = [];