Add question bank mastery paths and gap questions

This commit is contained in:
hz
2026-07-31 23:46:46 -05:00
parent 012d0cf196
commit 8c439c6294
28 changed files with 1409 additions and 121 deletions
@@ -55,7 +55,9 @@ public class QuestionsController : ControllerBase
[Authorize(Roles = "USER,SUPER")]
public async Task<IActionResult> Search([FromBody] QuestionSearchRequest req)
{
var questions = await _questions.SearchAsync(req, User.IsInRole("SUPER"));
List<Question> questions;
try { questions = await _questions.SearchAsync(req, User.IsInRole("SUPER")); }
catch (ArgumentException exception) { return BadRequest(exception.Message); }
var percentages = await _statistics.GetPercentagesByQuestionAsync(questions.Select(q => q.ExternalId));
var questionElos = await _ratings.GetQuestionElosAsync(questions.Select(q => q.ExternalId));
var bookmarkedIds = await _bookmarks.GetBookmarkedIdsAsync(UserId(), questions.Select(q => q.ExternalId));
@@ -22,9 +22,11 @@ public sealed class ReviewQueueController(
var userId = UserId();
if (string.IsNullOrWhiteSpace(userId)) return Unauthorized();
await queue.EnsureUserQueueAsync(userId);
var item = await queue.GetRandomPendingAsync(userId, req.ExcludeExternalIds);
ReviewQueueItem? item;
try { item = await queue.GetRandomPendingAsync(userId, req.ExcludeExternalIds, req.Step3System); }
catch (ArgumentException exception) { return BadRequest(exception.Message); }
if (item is null)
return Ok(new ReviewQueueNextResponse { PendingCount = checked((int)await queue.CountPendingAsync(userId)) });
return Ok(new ReviewQueueNextResponse { PendingCount = checked((int)await queue.CountPendingAsync(userId, req.Step3System)) });
var question = await questions.GetByExternalIdAsync(item.QuestionExternalId);
if (question is null || !question.IsPublished) return NotFound();
@@ -39,7 +41,7 @@ public sealed class ReviewQueueController(
{
Question = response,
Cycle = item.Cycle,
PendingCount = checked((int)await queue.CountPendingAsync(userId))
PendingCount = checked((int)await queue.CountPendingAsync(userId, req.Step3System))
});
}