Files
yourpart3/backend/migrations-active/20260826000000-repair-lesson-43-context-gap.cjs

29 lines
1.2 KiB
JavaScript

'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.
}
};