Skip to content

Commit 8cf055b

Browse files
committed
fix: add trim to filtering...
so that ' x' is recognized as 'x' or 'x '
1 parent 076dcc9 commit 8cf055b

File tree

1 file changed

+5
-2
lines changed
  • packages/vue/src/courses/default/questions/fillIn

1 file changed

+5
-2
lines changed

packages/vue/src/courses/default/questions/fillIn/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,12 @@ export class BlanksCard extends Question {
249249
s = s.substring(2, s.length - 2);
250250
const split = s.split('||');
251251
if (split.length > 1) {
252-
const answers = split[0].split('|');
252+
const answers = split[0].split('|').map((a) => a.trim());
253253
// remove answers from distractors (makes for easier editing to allow answers in the distractor list)
254-
const distractors = split[1].split('|').filter((d) => !answers.includes(d));
254+
const distractors = split[1]
255+
.split('|')
256+
.map((d) => d.trim())
257+
.filter((d) => !answers.includes(d));
255258

256259
const options = distractors;
257260
options.push(answers[randomInt(0, answers.length - 1)]);

0 commit comments

Comments
 (0)