Add core game retry flow and question stats

This commit is contained in:
hz
2026-07-10 14:05:57 -05:00
parent 1822c00a3b
commit e991dccbb2
17 changed files with 1036 additions and 80 deletions
@@ -126,6 +126,8 @@ public class QuestionsController : ControllerBase
return "correctChoiceId must match a choice id";
if (string.IsNullOrWhiteSpace(req.Explanation))
return "explanation required";
if (req.ChoiceSelectionPercentages.Any(entry => entry.Value is < 0 or > 100))
return "choiceSelectionPercentages values must be between 0 and 100";
if (string.IsNullOrWhiteSpace(req.System))
return "system required";
if (string.IsNullOrWhiteSpace(req.Discipline))
+1
View File
@@ -16,6 +16,7 @@ public class Question
public string CorrectChoiceId { get; set; } = "";
public string Explanation { get; set; } = "";
public Dictionary<string, string> ChoiceExplanations { get; set; } = [];
public Dictionary<string, int> ChoiceSelectionPercentages { get; set; } = [];
public string Discipline { get; set; } = "";
public string System { get; set; } = "";
public int Difficulty { get; set; } = 1;
@@ -19,6 +19,7 @@ public class UpsertQuestionRequest
public string CorrectChoiceId { get; set; } = "";
public string Explanation { get; set; } = "";
public Dictionary<string, string> ChoiceExplanations { get; set; } = [];
public Dictionary<string, int> ChoiceSelectionPercentages { get; set; } = [];
public string Discipline { get; set; } = "";
public string System { get; set; } = "";
public int Difficulty { get; set; } = 1;
@@ -10,6 +10,7 @@ public class QuestionResponse
public string CorrectChoiceId { get; set; } = "";
public string Explanation { get; set; } = "";
public Dictionary<string, string> ChoiceExplanations { get; set; } = [];
public Dictionary<string, int> ChoiceSelectionPercentages { get; set; } = [];
public string Discipline { get; set; } = "";
public string System { get; set; } = "";
public int Difficulty { get; set; }
@@ -27,6 +28,7 @@ public class QuestionResponse
CorrectChoiceId = question.CorrectChoiceId,
Explanation = question.Explanation,
ChoiceExplanations = question.ChoiceExplanations,
ChoiceSelectionPercentages = question.ChoiceSelectionPercentages,
Discipline = question.Discipline,
System = question.System,
Difficulty = question.Difficulty,
@@ -133,6 +133,7 @@ public class QuestionStore
CorrectChoiceId = req.CorrectChoiceId.Trim(),
Explanation = req.Explanation.Trim(),
ChoiceExplanations = req.ChoiceExplanations,
ChoiceSelectionPercentages = req.ChoiceSelectionPercentages,
Discipline = req.Discipline.Trim(),
System = req.System.Trim(),
Difficulty = req.Difficulty,