Loading TournamentManager/ViewModels/MatchEditViewModel.cs +5 −11 Original line number Diff line number Diff line Loading @@ -112,23 +112,17 @@ namespace TournamentManager.ViewModels /// <param name="teams">All teams participating in given tournament</param> private static void UpdatePlayoffs(List<Match> matches, List<TournamentTeam> teams) { if (matches.Count(m => m.Round == 0 && m.GoalsHost != m.GoalsGuest) != Match.groupMatchesTotal) if (matches.Count(m => m.Round == 1 && m.GoalsHost != m.GoalsGuest) != Match.groupMatchesTotal) { return; } List<TournamentTeam> groupA = [.. teams.Where(tt => tt.Group == TournamentTeamGroup.A)]; List<TournamentTeam> groupB = [.. teams.Where(tt => tt.Group == TournamentTeamGroup.B)]; List<TournamentTeam> groupA = [.. teams.Where(tt => tt.Group == TournamentTeamGroup.A).OrderBy(tt => tt.Place)]; List<TournamentTeam> groupB = [.. teams.Where(tt => tt.Group == TournamentTeamGroup.B).OrderBy(tt => tt.Place)]; for (int i = 0; i < 8; ++i) for (int i = 0; i <= 3; ++i) { Debug.Assert(groupA[i].Place == i + 1); Debug.Assert(groupB[i].Place == i + 1); } for (int i = 0; i < 3; ++i) { AssignTeams(matches[Match.groupMatchesTotal], groupA[i].IdTeam, groupB[3 - i].IdTeam); AssignTeams(matches[Match.groupMatchesTotal + i], groupA[i].IdTeam, groupB[3 - i].IdTeam); } } Loading Loading
TournamentManager/ViewModels/MatchEditViewModel.cs +5 −11 Original line number Diff line number Diff line Loading @@ -112,23 +112,17 @@ namespace TournamentManager.ViewModels /// <param name="teams">All teams participating in given tournament</param> private static void UpdatePlayoffs(List<Match> matches, List<TournamentTeam> teams) { if (matches.Count(m => m.Round == 0 && m.GoalsHost != m.GoalsGuest) != Match.groupMatchesTotal) if (matches.Count(m => m.Round == 1 && m.GoalsHost != m.GoalsGuest) != Match.groupMatchesTotal) { return; } List<TournamentTeam> groupA = [.. teams.Where(tt => tt.Group == TournamentTeamGroup.A)]; List<TournamentTeam> groupB = [.. teams.Where(tt => tt.Group == TournamentTeamGroup.B)]; List<TournamentTeam> groupA = [.. teams.Where(tt => tt.Group == TournamentTeamGroup.A).OrderBy(tt => tt.Place)]; List<TournamentTeam> groupB = [.. teams.Where(tt => tt.Group == TournamentTeamGroup.B).OrderBy(tt => tt.Place)]; for (int i = 0; i < 8; ++i) for (int i = 0; i <= 3; ++i) { Debug.Assert(groupA[i].Place == i + 1); Debug.Assert(groupB[i].Place == i + 1); } for (int i = 0; i < 3; ++i) { AssignTeams(matches[Match.groupMatchesTotal], groupA[i].IdTeam, groupB[3 - i].IdTeam); AssignTeams(matches[Match.groupMatchesTotal + i], groupA[i].IdTeam, groupB[3 - i].IdTeam); } } Loading