Fix history cursor parsing build

This commit is contained in:
hz
2026-07-14 21:22:09 -05:00
parent 0f43a51f2b
commit 52e82391ee
@@ -44,10 +44,12 @@ public class ExamSimulationsController(ExamSimulationStore simulations) : Contro
public async Task<IActionResult> Completed([FromQuery] int limit = 20, [FromQuery] string? before = null)
{
DateTime? cursor = null;
if (!string.IsNullOrWhiteSpace(before) && !DateTime.TryParse(before, null, System.Globalization.DateTimeStyles.RoundtripKind, out var parsed))
return BadRequest("The completed-simulation cursor is invalid.");
else if (!string.IsNullOrWhiteSpace(before))
if (!string.IsNullOrWhiteSpace(before))
{
if (!DateTime.TryParse(before, null, System.Globalization.DateTimeStyles.RoundtripKind, out var parsed))
return BadRequest("The completed-simulation cursor is invalid.");
cursor = parsed;
}
return Ok(await simulations.GetCompletedAsync(UserId(), limit, cursor));
}