feat(exercises): enhance gap exercise creation with contextual prompts and add migration for lesson 43
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const LESSON_TITLE = 'Kultur: Höflichkeit, Familie, Alltag';
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface) {
|
||||
await queryInterface.sequelize.transaction(async (transaction) => {
|
||||
// The old task asked for a soft refusal to an invitation, but expected
|
||||
// the unrelated cultural keyword "respeto". Test the matching phrase.
|
||||
await queryInterface.sequelize.query(`
|
||||
UPDATE community.vocab_grammar_exercise AS exercise
|
||||
SET question_data = '{"type":"gap_fill","text":"{gap}","gaps":1}'::jsonb,
|
||||
answer_data = '{"type":"gap_fill","answers":["Dili lang sa karon."]}'::jsonb,
|
||||
explanation = 'Das Kernmuster lautet: "Dili lang sa karon."'
|
||||
FROM community.vocab_course_lesson AS lesson
|
||||
WHERE exercise.lesson_id = lesson.id
|
||||
AND (lesson.id = 40 OR (lesson.course_id = 1 AND lesson.lesson_number = 43))
|
||||
AND exercise.title = :lessonTitle || ': Kernmuster ergänzen'
|
||||
AND exercise.question_data->>'type' = 'gap_fill'
|
||||
AND exercise.answer_data->'answers' @> '["respeto"]'::jsonb;
|
||||
`, { replacements: { lessonTitle: LESSON_TITLE }, transaction });
|
||||
});
|
||||
},
|
||||
|
||||
async down() {
|
||||
// Do not restore the semantically mismatched task.
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user