public JsonDotNetResult MarkTeamScoringComplete(MarkTeamScoringCompleteCommand command)
        {
            return Execute(
                action: () =>
                {
                    var score = GetPerformanceScore(command.PerformanceId);
                    var scores = GetScores(command.PerformanceId);
                    var calculator = new FiveJudgePanelPerformanceScoreCalculator(scores);

                    score.Update(calculator);
                    score.Update(command);
                    RavenSession.Store(score);

                    return new JsonDotNetResult(true);
                });
        }
        void Populate(CompetitionInfo info)
        {
            var performances =
                info.Registrations
                    .Select(x => x.GetPerformances(info.Competition))
                    .SelectMany(x => x)
                    .ToList();

            var panel = new FiveJudgePanel(new List<JudgeScore>());
            performances.ForEach(performance =>
            {
                var scores = panel.Judges.Select(judge => new JudgeScore(performance.Id, judge.Id)).ToList();
                var calculator = new FiveJudgePanelPerformanceScoreCalculator(scores);

                var score = new PerformanceScore {PerformanceId = performance.Id};
                var command = new MarkTeamScoringCompleteCommand
                {
                    PerformanceId = performance.Id,
                    RegistrationId = performance.RegistrationId,
                    DivisionId = performance.DivisionId,
                    CommandByUser = "******",
                    CommandWhen = DateTime.UtcNow
                };

                score.Update(calculator);
                score.Update(command);
                score.IsScoringComplete = false;

                scores.ForEach(RavenSession.Store);
                RavenSession.Store(score);
            });
        }
示例#3
0
 public void Update(MarkTeamScoringCompleteCommand command)
 {
     PerformanceId = command.PerformanceId;
     RegistrationId = command.RegistrationId;
     DivisionId = command.DivisionId;
     IsScoringComplete = true;
 }