From 90a4b987936cb51e00761a23735fe06390a851cb Mon Sep 17 00:00:00 2001 From: Morgan Brown Date: Mon, 8 Jul 2019 21:03:01 -0700 Subject: [PATCH 1/3] Allow submissions after the event is over without affecting the results --- .../Pages/Events/FastestSolves.cshtml.cs | 3 +- ServerCore/Pages/Events/Standings.cshtml.cs | 3 +- ServerCore/Pages/Submissions/Index.cshtml | 47 ++++++++++--------- ServerCore/Pages/Submissions/Index.cshtml.cs | 4 +- ServerCore/Pages/Teams/Play.cshtml | 7 +-- 5 files changed, 36 insertions(+), 28 deletions(-) diff --git a/ServerCore/Pages/Events/FastestSolves.cshtml.cs b/ServerCore/Pages/Events/FastestSolves.cshtml.cs index 0a7a952c..ac72eaa7 100644 --- a/ServerCore/Pages/Events/FastestSolves.cshtml.cs +++ b/ServerCore/Pages/Events/FastestSolves.cshtml.cs @@ -43,9 +43,10 @@ public async Task OnGetAsync(SortOrder? sort, PuzzleStateFilter? stateFilter) names.ForEach(t => teamNameLookup[t.ID] = t.Name); + DateTime submissionEnd = Event.AnswerSubmissionEnd; // get the page data: puzzle, solve count, top three fastest var puzzlesData = await PuzzleStateHelper.GetSparseQuery(_context, this.Event, null, null) - .Where(s => s.SolvedTime != null && s.Puzzle.IsPuzzle) + .Where(s => s.SolvedTime != null && s.Puzzle.IsPuzzle && s.SolvedTime < submissionEnd) .GroupBy(state => state.Puzzle) .Select(g => new { Puzzle = g.Key, diff --git a/ServerCore/Pages/Events/Standings.cshtml.cs b/ServerCore/Pages/Events/Standings.cshtml.cs index ff7b390f..b3da8cc8 100644 --- a/ServerCore/Pages/Events/Standings.cshtml.cs +++ b/ServerCore/Pages/Events/Standings.cshtml.cs @@ -31,8 +31,9 @@ public async Task OnGetAsync(SortOrder? sort) .Where(p => p.Event == Event && p.IsPuzzle) .ToDictionaryAsync(p => p.ID, p => new { p.SolveValue, p.IsCheatCode, p.IsFinalPuzzle }); + DateTime submissionEnd = Event.AnswerSubmissionEnd; var stateData = await PuzzleStateHelper.GetSparseQuery(_context, this.Event, null, null) - .Where(pspt => pspt.SolvedTime != null) + .Where(pspt => pspt.SolvedTime != null && pspt.SolvedTime < submissionEnd) .Select(pspt => new { pspt.PuzzleID, pspt.TeamID, pspt.SolvedTime }) .ToListAsync(); diff --git a/ServerCore/Pages/Submissions/Index.cshtml b/ServerCore/Pages/Submissions/Index.cshtml index 01d7ef06..7278127d 100644 --- a/ServerCore/Pages/Submissions/Index.cshtml +++ b/ServerCore/Pages/Submissions/Index.cshtml @@ -57,8 +57,6 @@
} -
-
@if (Model.Puzzle.HasDataConfirmation) {
@@ -73,11 +71,10 @@ Answer: @Model.AnswerToken
} - else if (!@Model.Event.IsAnswerSubmissionActive) + else if (@Model.Event.EventBegin > DateTime.UtcNow) {
-

Answer Submission Closed

- No submissions will be accepted at this time. +

This event is not yet in session. No submissions will be accepted at this time.

} else if (Model.PuzzleState.IsEmailOnlyMode) @@ -103,30 +100,38 @@ } else { - if (Model.DuplicateSubmission) + if (@Model.Event.AnswerSubmissionEnd < DateTime.UtcNow) + { + + } + + @if (Model.DuplicateSubmission) { } - -
-
-
- - - Submitted answers will automatically be capitalized and stripped of non-alphanumeric characters
- @Html.ValidationSummary(true) - +
+
+ +
+
+ + + Submitted answers will automatically be capitalized and stripped of non-alphanumeric characters
+ @Html.ValidationSummary(true) + +
+
+ +
+
-
- -
- +
} -
-
@if (Model.SubmissionViews.Count > 0) { diff --git a/ServerCore/Pages/Submissions/Index.cshtml.cs b/ServerCore/Pages/Submissions/Index.cshtml.cs index 2c041b48..48875c19 100644 --- a/ServerCore/Pages/Submissions/Index.cshtml.cs +++ b/ServerCore/Pages/Submissions/Index.cshtml.cs @@ -53,7 +53,7 @@ public async Task OnPostAsync(int puzzleId, string submissionText } SubmissionText = submissionText; - if (!this.Event.IsAnswerSubmissionActive) + if (Event.EventBegin > DateTime.UtcNow) { return Page(); } @@ -126,7 +126,7 @@ await PuzzleStateHelper.SetSolveStateAsync(_context, AnswerToken = submission.SubmissionText; } - else if (submission.Response == null) + else if (submission.Response == null && Event.IsAnswerSubmissionActive) { // We also determine if the puzzle should be set to email-only mode. if (IsPuzzleSubmissionLimitReached( diff --git a/ServerCore/Pages/Teams/Play.cshtml b/ServerCore/Pages/Teams/Play.cshtml index 81a62eeb..21d0c041 100644 --- a/ServerCore/Pages/Teams/Play.cshtml +++ b/ServerCore/Pages/Teams/Play.cshtml @@ -7,7 +7,8 @@ ViewData["AuthorRoute"] = "/Puzzles/Index"; // Needs route data - ViewData["PlayRoute"] = "/Teams/Play"; - Boolean unsolvedFilter = Model.StateFilter == PlayModel.PuzzleStateFilter.Unsolved; + bool unsolvedFilter = Model.StateFilter == PlayModel.PuzzleStateFilter.Unsolved; + bool canSubmit = Model.Event.EventBegin < DateTime.UtcNow; }

Puzzles

+@if (DateTime.UtcNow > @Model.Event.AnswerSubmissionEnd) +{ + +}
View All Correct Answers
@@ -138,7 +145,7 @@ } else { - + Not yet available } From 2aaab62377af7f65fb69337ba410ca21fa8fed3c Mon Sep 17 00:00:00 2001 From: Morgan Brown Date: Wed, 10 Jul 2019 21:19:52 -0700 Subject: [PATCH 3/3] Allow solves at the very end of the event in standings --- ServerCore/Pages/Events/FastestSolves.cshtml.cs | 2 +- ServerCore/Pages/Events/Standings.cshtml.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ServerCore/Pages/Events/FastestSolves.cshtml.cs b/ServerCore/Pages/Events/FastestSolves.cshtml.cs index ac72eaa7..80d20a94 100644 --- a/ServerCore/Pages/Events/FastestSolves.cshtml.cs +++ b/ServerCore/Pages/Events/FastestSolves.cshtml.cs @@ -46,7 +46,7 @@ public async Task OnGetAsync(SortOrder? sort, PuzzleStateFilter? stateFilter) DateTime submissionEnd = Event.AnswerSubmissionEnd; // get the page data: puzzle, solve count, top three fastest var puzzlesData = await PuzzleStateHelper.GetSparseQuery(_context, this.Event, null, null) - .Where(s => s.SolvedTime != null && s.Puzzle.IsPuzzle && s.SolvedTime < submissionEnd) + .Where(s => s.SolvedTime != null && s.Puzzle.IsPuzzle && s.SolvedTime <= submissionEnd) .GroupBy(state => state.Puzzle) .Select(g => new { Puzzle = g.Key, diff --git a/ServerCore/Pages/Events/Standings.cshtml.cs b/ServerCore/Pages/Events/Standings.cshtml.cs index b3da8cc8..3576b528 100644 --- a/ServerCore/Pages/Events/Standings.cshtml.cs +++ b/ServerCore/Pages/Events/Standings.cshtml.cs @@ -33,7 +33,7 @@ public async Task OnGetAsync(SortOrder? sort) DateTime submissionEnd = Event.AnswerSubmissionEnd; var stateData = await PuzzleStateHelper.GetSparseQuery(_context, this.Event, null, null) - .Where(pspt => pspt.SolvedTime != null && pspt.SolvedTime < submissionEnd) + .Where(pspt => pspt.SolvedTime != null && pspt.SolvedTime <= submissionEnd) .Select(pspt => new { pspt.PuzzleID, pspt.TeamID, pspt.SolvedTime }) .ToListAsync();