Add clinical progression ranks and records
This commit is contained in:
@@ -13,7 +13,8 @@ public class ExamSimulationsController(
|
||||
ExamSimulationStore simulations,
|
||||
CreditStore credits,
|
||||
MasteryAwardService masteryAwards,
|
||||
StudySessionStore studySessions) : ControllerBase
|
||||
StudySessionStore studySessions,
|
||||
ProgressionStore progression) : ControllerBase
|
||||
{
|
||||
[HttpGet("readiness")]
|
||||
public async Task<IActionResult> Readiness() => Ok(await simulations.GetReadinessAsync(UserId()));
|
||||
@@ -145,6 +146,7 @@ public class ExamSimulationsController(
|
||||
{
|
||||
var userId = UserId();
|
||||
await masteryAwards.PrepareAsync(userId);
|
||||
await progression.PrepareAsync(userId);
|
||||
simulation = await simulations.SubmitBlockAsync(simulation);
|
||||
var response = await simulations.ToResponseAsync(simulation);
|
||||
var session = await studySessions.CompleteSimulationBlockAsync(userId, simulation.Id ?? id, simulation.CurrentBlock);
|
||||
@@ -164,6 +166,10 @@ public class ExamSimulationsController(
|
||||
}
|
||||
else if (session.Summary is not null)
|
||||
response.Credits = await credits.GetStatusAsync(userId);
|
||||
var progressionResult = await progression.RefreshAsync(userId);
|
||||
response.Progression = progressionResult.State;
|
||||
response.CreditAwards.AddRange(progressionResult.Awards);
|
||||
if (progressionResult.Awards.Count > 0) response.Credits = await credits.GetStatusAsync(userId);
|
||||
return Ok(response);
|
||||
}
|
||||
catch (InvalidOperationException exception) { return Conflict(exception.Message); }
|
||||
|
||||
Reference in New Issue
Block a user