From 52e82391eefa81e20953cfd70b2c09d7193f2b79 Mon Sep 17 00:00:00 2001 From: hz Date: Tue, 14 Jul 2026 21:22:09 -0500 Subject: [PATCH] Fix history cursor parsing build --- api/QuestionsApi/Controllers/ExamSimulationsController.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/QuestionsApi/Controllers/ExamSimulationsController.cs b/api/QuestionsApi/Controllers/ExamSimulationsController.cs index 6752192..b4a75cb 100644 --- a/api/QuestionsApi/Controllers/ExamSimulationsController.cs +++ b/api/QuestionsApi/Controllers/ExamSimulationsController.cs @@ -44,10 +44,12 @@ public class ExamSimulationsController(ExamSimulationStore simulations) : Contro public async Task 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)); }