コード例 #1
0
        public void GivenASetOfScores(Table table)
        {
            _scores = new List<JudgeScore>();

            foreach (var row in table.Rows)
            {
                var score = new JudgeScore();
                var keys = row.Keys.ToList();
                score.PerformanceId = row[keys[0]];
                for (int i = 1; i < keys.Count; i++)
                {
                    var str = row[keys[i]];
                    if (string.IsNullOrWhiteSpace(str))
                        continue;

                    var value = decimal.Parse(str);
                    score.Scores.Add(keys[i], new ScoreEntry() { Base = value }); //total hack to get the value in
                }

                _scores.Add(score);
            }
        }
コード例 #2
0
        public ActionResult ScoreEntry(ScoreEntryRequestModel request)
        {
            var ok = FiveJudgePanel.JudgeIds.Contains(request.JudgeId); //HACK: pivot if more panel types; move to attribute?; good spot for Fubu
            ok = ok && User.CanActAsJudge(request.JudgeId);

            if (!ok)
                return RedirectToAction("Summary", "Scoring", new { PerformanceId = request.PerformanceId.ForScoringMvc() });

            var score =
                RavenSession
                    .Load<JudgeScore>(JudgeScore.FormatId(request.PerformanceId, request.JudgeId));

            if (score == null)
            {
                score = new JudgeScore(request.PerformanceId, request.JudgeId);//TODO: MARK
                RavenSession.Store(score);
            }

            var model = new ScoringScoreEntryViewModel(score);
            return View(model);
        }
コード例 #3
0
 public ScoringScoreEntryViewModel(JudgeScore score)
 {
     CompetitionId = score.PerformanceId.ExtractCompetitionId();  //TODO: MARK
     PerformanceId = score.PerformanceId;
     Score = score;
 }