Implement nested question remediation and review content
This commit is contained in:
@@ -45,6 +45,9 @@ public class QuestionReportStore
|
||||
.ToList(),
|
||||
CorrectChoiceId = question.CorrectChoiceId,
|
||||
Explanation = question.Explanation,
|
||||
KeyTakeaway = question.KeyTakeaway,
|
||||
UsmlePearl = question.UsmlePearl,
|
||||
ReviewFollowups = question.ReviewFollowups,
|
||||
ChoiceExplanations = new Dictionary<string, string>(question.ChoiceExplanations),
|
||||
WrongAnswerFollowups = question.WrongAnswerFollowups.ToDictionary(
|
||||
item => item.Key,
|
||||
|
||||
@@ -206,6 +206,9 @@ public class QuestionStore
|
||||
Choices = req.Choices,
|
||||
CorrectChoiceId = req.CorrectChoiceId.Trim(),
|
||||
Explanation = req.Explanation.Trim(),
|
||||
KeyTakeaway = req.KeyTakeaway.Trim(),
|
||||
UsmlePearl = req.UsmlePearl.Trim(),
|
||||
ReviewFollowups = req.ReviewFollowups,
|
||||
ChoiceExplanations = req.ChoiceExplanations,
|
||||
WrongAnswerFollowups = req.WrongAnswerFollowups,
|
||||
ChoiceSelectionPercentages = req.ChoiceSelectionPercentages,
|
||||
|
||||
@@ -50,6 +50,21 @@ public static class QuestionValidator
|
||||
return "wrongAnswerFollowups correctChoiceId must match a follow-up choice id";
|
||||
}
|
||||
|
||||
if (req.ReviewFollowups is null) return "reviewFollowups must be an array";
|
||||
if (req.ReviewFollowups.Count > 10) return "questions support at most ten review follow-ups";
|
||||
foreach (var followup in req.ReviewFollowups)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(followup.Prompt)) return "reviewFollowups prompt required";
|
||||
if (string.IsNullOrWhiteSpace(followup.TeachingPoint)) return "reviewFollowups teachingPoint required";
|
||||
if (followup.Choices.Count < 2) return "reviewFollowups require at least two choices";
|
||||
if (followup.Choices.Any(choice => string.IsNullOrWhiteSpace(choice.Id) || string.IsNullOrWhiteSpace(choice.Text)))
|
||||
return "reviewFollowups choice ids and text are required";
|
||||
if (followup.Choices.Select(choice => choice.Id).Distinct(StringComparer.Ordinal).Count() != followup.Choices.Count)
|
||||
return "reviewFollowups choice ids must be unique";
|
||||
if (!followup.Choices.Any(choice => choice.Id == followup.CorrectChoiceId))
|
||||
return "reviewFollowups correctChoiceId must match a follow-up choice id";
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(req.System)) return "system required";
|
||||
if (string.IsNullOrWhiteSpace(req.Discipline)) return "discipline required";
|
||||
if (req.Difficulty is < 1 or > 5) return "difficulty must be between 1 and 5";
|
||||
|
||||
Reference in New Issue
Block a user