public JsonDotNetResult HighMediumLow(string performanceId)
 {
     var scores = GetScores(performanceId);
     var panel = new FiveJudgePanel(scores);
     var model = new HighMediumLowViewModel(panel);
     return new JsonDotNetResult(model);
 }
        public ActionResult FiveJudgePanelSummary(string performanceId)
        {
            var scores = GetScores(performanceId);

            var panel = new FiveJudgePanel(scores);
            var score = GetPerformanceScore(performanceId);
            var model = new ScoringFiveJudgePanelViewModel(performanceId, score, panel);

            return View("FiveJudgePanelSummary", model);
        }
        public CompetitionLayoutIndexViewModel(CompetitionInfo info, ScoringMap scoringMap)
        {
            Info = info;
            ScoringMap = scoringMap;

            Performances =
                info
                    .Registrations
                    .SelectMany(x => x.GetPerformances(info.Competition))
                    .ToList();

            var go =
                Performances.Where(x => x.RegistrationId == "company/1/competitions/5/registrations/gyms/41/team/12").ToList();

            JudgePanel = new FiveJudgePanel(new List<JudgeScore>()); //TODO: If we need a different panel....
            SecurityContext = new SecurityContext();
        }
        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);
            });
        }