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); } }
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); }
public ScoringScoreEntryViewModel(JudgeScore score) { CompetitionId = score.PerformanceId.ExtractCompetitionId(); //TODO: MARK PerformanceId = score.PerformanceId; Score = score; }