Add functional simulation question review
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user