Redesign exam and CCS experiences

This commit is contained in:
hz
2026-07-16 22:42:03 -05:00
parent c8bfc26645
commit a778a680e0
35 changed files with 2132 additions and 274 deletions
@@ -51,27 +51,33 @@ public class ExamSimulationsController(ExamSimulationStore simulations) : Contro
[HttpGet("completed")]
public async Task<IActionResult> Completed([FromQuery] int limit = 20, [FromQuery] string? before = null)
{
DateTime? cursor = null;
DateTime? completedBefore = null;
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;
completedBefore = parsed;
}
return Ok(await simulations.GetCompletedAsync(UserId(), limit, cursor));
return Ok(await simulations.GetCompletedAsync(UserId(), limit, completedBefore));
}
[HttpGet("history")]
public async Task<IActionResult> History([FromQuery] int limit = 20, [FromQuery] string? before = null)
public async Task<IActionResult> History(
[FromQuery] int limit = 20,
[FromQuery] string status = "all",
[FromQuery] string sort = "newest",
[FromQuery] string? cursor = null,
[FromQuery] string? before = null)
{
DateTime? cursor = null;
DateTime? legacyBefore = null;
if (!string.IsNullOrWhiteSpace(before))
{
if (!DateTime.TryParse(before, null, System.Globalization.DateTimeStyles.RoundtripKind, out var parsed))
return BadRequest("The simulation-history cursor is invalid.");
cursor = parsed;
legacyBefore = parsed;
}
return Ok(await simulations.GetHistoryAsync(UserId(), limit, cursor));
try { return Ok(await simulations.GetHistoryAsync(UserId(), limit, status, sort, cursor, legacyBefore)); }
catch (ArgumentException exception) { return BadRequest(exception.Message); }
}
[HttpGet("{id}")]