/// <summary> /// Instantiates a new HeadJudgeViewModel by loading necessary properties from Tournament.. /// </summary> public HeadJudgeViewModel(Tournament tourney, NordicArenaDomainModels.Models.Judge judge, ICollection <NordicArenaDomainModels.Models.Judge> judges) { Tournament = tourney; Criteria = tourney.JudgingCriteria.OrderBy(p => p.Id).ToList(); Judges = judges; Judge = judge; Contestants = ContestantRunViewModel.CreateListOfCurrentConestants(tourney, judge.Id); //CanJudge = Contestants.Count > 0 && Contestants[0].Scores.All(p => p.Score != null); JudgeStatus = JudgeHasScoredTuple.GetJudgeStatusListForCurrentHeat(tourney); JudgeViewModels = GetJudgeViewModels(); AverageCriteriaScore = new List <decimal?>(); foreach (var j in JudgeStatus) { if (!j.HasJudged) { CanJudge = false; } } if (CanJudge) { SetAverageScores(); } }
public RunJudging(RoundContestant contestant, Judge judge, JudgingCriterion criterion, int runNo, decimal?score) : this() { RoundContestant = contestant; RoundContestantId = contestant.Id; Judge = judge; JudgeId = judge.Id; Criterion = criterion; CriterionId = criterion.Id; RunNo = runNo; Score = score; }
/// <summary> /// Instantiates a new JudgeViewModel by loading necessary properties from Tournament.. /// </summary> public JudgeViewModel(Tournament tourney, NordicArenaDomainModels.Models.Judge judge) { Tournament = tourney; Criteria = tourney.JudgingCriteria.OrderBy(p => p.Id).ToList(); Judge = judge; Contestants = ContestantRunViewModel.CreateListOfCurrentConestants(tourney, judge.Id); ClosestContestants = new ClosestContestantsViewModel(tourney, tourney.GetCurrentRound().RoundNo); if (Judge.IsHeadJudge) { AverageCriteriaScore = new List <decimal?>(); AverageTotalScore = new List <decimal?>(); RemoveHeadJudgeFromJudgeList(Tournament.Judges, Judge.Id); Judges = Tournament.Judges; JudgeStatus = JudgeHasScoredTuple.GetJudgeStatusListForCurrentHeat(tourney); JudgeViewModels = GetJudgeViewModels(); CanJudge = true; foreach (var j in JudgeStatus) { if (!j.HasJudged) { CanJudge = false; } } HasHeadJudgeJudged = SetHasHeadJudgeJudged(); if (!HasHeadJudgeJudged && JudgeStatus.Count > 0) { SetAverageScores(); } } else { CanJudge = Contestants.Count > 0 && Contestants[0].Scores.All(p => p.Score == null); } }
public bool IsJudgedBy(Judge judge, int runNo, int criteriaCount) { int count = RunJudgings.Count(p => p.RunNo == runNo && p.JudgeId == judge.Id); return(count == criteriaCount); }
public JudgeListAndCreate() { Judges = new List <NordicArenaDomainModels.Models.Judge>(); NewJudge = new NordicArenaDomainModels.Models.Judge(); }