fixing multiline feedback

This commit is contained in:
2025-10-22 11:52:06 -06:00
parent 4c978f392d
commit 47c69251c8
3 changed files with 19 additions and 12 deletions

View File

@@ -89,27 +89,30 @@ function QuizQuestionPreview({ question }: { question: LocalQuizQuestion }) {
<div>Feedback</div>
<div className="mx-4 space-y-1">
{question.correctComments && (
<div className="border-l-2 border-green-700 pl-2 py-1">
<div className="border-l-2 border-green-700 pl-2 py-1 flex">
<span className="text-green-500">+ </span>
<span className="text-slate-300">
{question.correctComments}
</span>
<MarkdownDisplay
markdown={question.correctComments}
className="ms-4 mb-2"
/>
</div>
)}
{question.incorrectComments && (
<div className="border-l-2 border-red-700 pl-2 py-1">
<div className="border-l-2 border-red-700 pl-2 py-1 flex">
<span className="text-red-500">- </span>
<span className="text-slate-300">
{question.incorrectComments}
</span>
<MarkdownDisplay
markdown={question.incorrectComments}
className="ms-4 mb-2"
/>
</div>
)}
{question.neutralComments && (
<div className="border-l-2 border-blue-800 pl-2 py-1">
<div className="border-l-2 border-blue-800 pl-2 py-1 flex">
<span className="text-blue-500">... </span>
<span className="text-slate-300">
{question.neutralComments}
</span>
<MarkdownDisplay
markdown={question.neutralComments}
className="ms-4 mb-2"
/>
</div>
)}
</div>

View File

@@ -319,5 +319,6 @@ essay
expect(firstQuestion.questionType).toBe(QuestionType.ESSAY);
expect(firstQuestion.text).not.toContain("this is general feedback");
expect(firstQuestion.neutralComments).toBe("this is general feedback");
expect(firstQuestion.neutralComments).not.toContain("...");
});
});

View File

@@ -70,12 +70,15 @@ export const quizFeedbackMarkdownUtils = {
.replace(feedbackIndicators[currentFeedbackType], "")
.trim();
comments[currentFeedbackType].push(lineWithoutIndicator);
} else if (lineFeedbackType !== "none") {
const lineWithoutIndicator = line
.replace(feedbackIndicators[lineFeedbackType], "")
.trim();
currentFeedbackType = lineFeedbackType;
comments[lineFeedbackType].push(lineWithoutIndicator);
} else {
otherLines.push(line);
}