Add functional simulation question review

This commit is contained in:
hz
2026-07-14 17:49:23 -05:00
parent 3e39a4ffce
commit 705f079997
13 changed files with 551 additions and 32 deletions
@@ -62,6 +62,24 @@ public class QuestionResponse
};
}
public static QuestionResponse FromModelWithChoices(
Question question,
IReadOnlyCollection<string> presentedChoiceIds,
int questionElo = 1000)
{
var response = FromModel(question, questionElo: questionElo, includeChoicePool: true);
var ids = presentedChoiceIds.ToHashSet(StringComparer.Ordinal);
response.Choices = presentedChoiceIds
.Select(id => question.Choices.FirstOrDefault(choice => choice.Id == id))
.Where(choice => choice is not null)
.Cast<QuestionChoice>()
.ToList();
response.ChoiceExplanations = response.ChoiceExplanations.Where(entry => ids.Contains(entry.Key)).ToDictionary();
response.WrongAnswerFollowups = response.WrongAnswerFollowups.Where(entry => ids.Contains(entry.Key)).ToDictionary();
response.ChoiceSelectionPercentages = response.ChoiceSelectionPercentages.Where(entry => ids.Contains(entry.Key)).ToDictionary();
return response;
}
private static List<QuestionChoice> SelectLegacyChoices(Question question)
{
if (question.Choices.Count <= 5)