/// <summary> /// Replaces list of runJudging scores as well as calculates total on RoundContestant if done. /// Less optimized than ReplaceRunJudgings(ContestantRunViewModel model), as it fetches roundContestant for each runJudging line /// </summary> public virtual void ReplaceRunJudgings(List <RunJudging> list, Tournament tourney) { var expectedJudgeEntriesPerRun = tourney.GetExpectedJudgementCountPerRun(); foreach (var score in list) { RunJudgings.Replace(score); RoundContestant contestant = GetRoundContestantGuarded(score.RoundContestantId); contestant.CalculateTotalScore(expectedJudgeEntriesPerRun, contestant.Round.RunsPerContestant); } SaveChanges(); }
/// <summary> /// Replaces list of runJudging scores as well as calculates total on RoundContestant if done /// </summary> /// <param name="model"></param> public virtual void ReplaceRunJudgings(ContestantRunViewModel model) { Tournament tourney = GetTournamentGuarded(model.TournamentId); RoundContestant contestant = GetRoundContestantGuarded(model.RoundContestantId); foreach (var score in model.Scores) { RunJudgings.Replace(score); } var expectedJudgeEntriesPerRun = tourney.GetExpectedJudgementCountPerRun(); contestant.CalculateTotalScore(expectedJudgeEntriesPerRun, contestant.Round.RunsPerContestant); SaveChanges(); }
/// <summary> /// Replaces list of runJudging scores for a single round consteants. Calculates total on RoundContestant if all scores registerd. /// </summary> public virtual void ReplaceRunJudgings(long tournamentId, long roundContestantId, List <RunJudging> runJudgings) { Tournament tourney = GetTournamentGuarded(tournamentId); RoundContestant contestant = GetRoundContestantGuarded(roundContestantId); foreach (var score in runJudgings) { RunJudgings.Replace(score); } var expectedJudgeEntriesPerRun = tourney.GetExpectedJudgementCountPerRun(); contestant.CalculateTotalScore(expectedJudgeEntriesPerRun, contestant.Round.RoundNo, contestant.Round.RunsPerContestant); SaveChanges(); }
/// <summary> /// Adds or replaces juding for particular run /// </summary> /// <param name="judging"></param> public void ReplaceRunJudging(RunJudging judging) { RunJudgings.Replace(judging); SaveChanges(); }