예제 #1
0
        public static void UpdateTournamentResults(TournamentModel model)
        {
            var startingRound = model.CheckCurrentRound();
            var toScore       = new List <MatchupModel>();

            foreach (List <MatchupModel> round in model.Rounds)
            {
                foreach (MatchupModel rm in round)
                {
                    if (rm.Winner == null && (rm.Entries.Any(x => x.Score != 0) || rm.Entries.Count == 1))
                    {
                        toScore.Add(rm);
                    }
                }
            }

            MarkWinnerInMatchups(toScore);

            AdvanceWinners(toScore, model);

            toScore.ForEach(x => GlobalConfig.Connections.UpdateMatchup(x));
            var endingRound = model.CheckCurrentRound();

            if (endingRound > startingRound)
            {
                model.AlertUsersToNewRounds();
            }
        }