public bool SetMatchResult(List <string> HplayerGoals, List <string> VplayerGoals) { if (CurrentUser.Profile != Profile.CBF) { return(false); } var CurrentRound = Rounds.FirstOrDefault(round => round.PlayedRound == false); if (CurrentRound == null) { return(false); } var currentMatch = CurrentRound.Matches.FirstOrDefault(match => match.VisitingTeamGoals == null); if (currentMatch == null) { return(false); } currentMatch.PlayMatch(HplayerGoals, VplayerGoals); if (CurrentRound.Matches.All(match => match.VisitingTeamGoals != null)) { CurrentRound.PlayedRound = true; } return(true); }
// load rounds for compo public async Task ExecuteLoadRoundsCommand() { if (IsBusy) { return; } IsBusy = true; //DoStuff Rounds = await azureService.GetRoundsForCompetition(SelectedCompetition?.CompetitionId); IsBusy = false; if (Rounds.Count > 0) { // set round pref on dropdown string roundId = Preferences.Get("RoundId", null); if (roundId != null) { var round = Rounds.FirstOrDefault(o => o.RoundId == roundId); if (round != null) { SelectedRound = round; Debug.WriteLine("Set SelectedRound to " + round.CourseName); } } } }
public CcjRound GetCurrentInputRegisterableRoundOrDefault(bool syncLock = true) { if (syncLock) { using (RoundsListLock.Lock()) { return(Rounds.FirstOrDefault(x => x.Status == CcjRoundStatus.Running && x.Phase == CcjRoundPhase.InputRegistration)); } } return(Rounds.FirstOrDefault(x => x.Status == CcjRoundStatus.Running && x.Phase == CcjRoundPhase.InputRegistration)); }
public Round GetNextRound(Round currentRound = null) { if (currentRound == null) { currentRound = GetCurrentRound(); } if (currentRound == null) { return(GetRoundsOrdered().FirstOrDefault()); } return(Rounds.FirstOrDefault(p => currentRound.Equals(p.QualifiesFromRound))); }
/// <summary> /// Starts the tournament /// </summary> /// <param name="contestantListSorter">An optional implementation of a list sorting algorithm. Defaults to random player shuffeling.</param> public void Start(IListSorter contestantListSorter = null) { if (contestantListSorter == null) { contestantListSorter = GetListSorter(); } var round1 = Rounds.FirstOrDefault(p => p.RoundNo == 1); round1.Start(contestantListSorter, Contestants); // Set current contestant and tournament status Status = TournamentStatus.Running; ResetCounterSet(); }
public async Task LoadDataAsync() { if (IsBusy) { return; } IsBusy = true; // load lookups for the Round model await azureService.LoadCourseLookup(); await azureService.LoadPlayerLookup(); await azureService.LoadSocietyLookup(Preferences.Get("PlayerId", string.Empty)); await azureService.LoadCompetitionLookup(Preferences.Get("SocietyId", string.Empty)); // get competition // _selectedCompetition = await azureService.GetCompetition(_competitionId); // CompetitionName = Competition.CompetitionName; Title = Competition.CompetitionName; //Load rounds Rounds = await azureService.GetRoundsForCompetition(Competition.CompetitionId); // all overall selector Rounds.Insert(0, new Round() { RoundId = "ALL", RoundDate = Competition.StartDate }); // set round in picker if (Rounds.Count > 1) { // if saved round in in list, select it, otherwise select first one Round prefRound = Rounds.FirstOrDefault(o => o.RoundId == Preferences.Get("RoundId", null)); if (prefRound != null) { SelectedRound = prefRound; } else { SelectedRound = Rounds.FirstOrDefault(); } } IsBusy = false; }
/// <summary> /// Returns first running round or the last round in the tournament if tournament ended /// </summary> /// <returns></returns> public Round GetCurrentOrDefaultRound() { var round = GetCurrentRound(); if (round == null) { round = Rounds.FirstOrDefault(p => p.Status == TournamentStatus.Prestart); } if (round == null) { round = Rounds.LastOrDefault(p => p.Status == TournamentStatus.Ended); } return(round); }
public Match FindCurrentMatch() { if (CurrentUser.Profile != Profile.CBF) { return(null); } var CurrentRound = Rounds.FirstOrDefault(round => round.PlayedRound == false); if (CurrentRound == null) { return(null); } CurrentMatch = CurrentRound.Matches.FirstOrDefault(match => match.VisitingTeamGoals == null); return(CurrentMatch); }
// load rounds for compo public async Task ExecuteLoadRoundsCommand() { if (IsBusy) { return; } IsBusy = true; //DoStuff Rounds = await azureService.GetRoundsForCompetition(SelectedCompetition?.CompetitionId); IsBusy = false; // set round pref on dropdown Debug.WriteLine("Setting SelectedRound in ExecuteLoadRoundsCommand"); SelectedRound = Rounds.FirstOrDefault(o => o.RoundId == Preferences.Get("RoundId", string.Empty).ToString()); }
private Round GetRound(uint256 roundId) => Rounds.FirstOrDefault(x => x.Id == roundId) ?? throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.RoundNotFound, $"Round ({roundId}) not found.");
/// <summary> /// Returns first round with the specified round number /// </summary> public Round GetRoundNo(int roundNo) { return(Rounds.FirstOrDefault(p => p.RoundNo == roundNo)); }
public RoundBase GetRoundByName(string roundName) { return(Rounds.FirstOrDefault(round => round.Name.ToLower() == roundName.ToLower())); }
public RoundBase GetRoundById(Guid roundId) { return(Rounds.FirstOrDefault(round => round.Id == roundId)); }