can get exact answers

This commit is contained in:
2025-10-22 13:18:18 -06:00
parent d9f7e7b3e9
commit b53948db72
10 changed files with 97 additions and 95 deletions

View File

@@ -16,7 +16,7 @@ import {
rateLimitAwarePost,
} from "./canvasWebRequestUtils";
export const getAnswers = (
export const getAnswersForCanvas = (
question: LocalQuizQuestion,
settings: LocalCourseSettings
) => {
@@ -32,6 +32,13 @@ export const getAnswers = (
};
});
if (question.questionType === QuestionType.NUMERICAL) {
return question.answers.map((answer) => ({
numerical_answer_type: answer.numericalAnswerType,
exact: answer.numericAnswer,
}));
}
return question.answers.map((answer) => ({
answer_html: markdownToHTMLSafe({ markdownString: answer.text, settings }),
answer_weight: answer.correct ? 100 : 0,
@@ -64,7 +71,7 @@ const createQuestionOnly = async (
question_type: getQuestionTypeForCanvas(question),
points_possible: question.points,
position,
answers: getAnswers(question, settings),
answers: getAnswersForCanvas(question, settings),
correct_comments: question.incorrectComments,
incorrect_comments: question.incorrectComments,
neutral_comments: question.neutralComments,