feat(exercises): enhance context in gap fill exercises and update migration for route descriptions
All checks were successful
Deploy to production / deploy (push) Successful in 3m21s

This commit is contained in:
Torsten Schulz (local)
2026-09-02 13:52:26 +02:00
parent 76da586b8e
commit 504f527a3f
3 changed files with 111 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
'use strict';
/**
* The generated exercise for "Wege & Verkehr" used a bare `{gap}` while its
* instruction asked for a route description. A gap must be embedded in the
* route so the learner can infer the expected direction from the context.
*/
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.query(`
UPDATE community.vocab_grammar_exercise AS exercise
SET title = 'Wege & Verkehr: Satz im Kontext ergänzen',
question_data = '{"type":"gap_fill","text":"{gap}. Tuo. Wala. Duol ra.","gaps":1}'::jsonb,
answer_data = '{"type":"gap_fill","answers":["Diretso"]}'::jsonb,
explanation = 'Die vollständige Wegbeschreibung lautet: "Diretso. Tuo. Wala. Duol ra."'
FROM community.vocab_course_lesson AS lesson
WHERE exercise.lesson_id = lesson.id
AND (lesson.id = 1532 OR (lesson.course_id = 1 AND lesson.lesson_number = 55))
AND lesson.title = 'Wege & Verkehr'
AND exercise.question_data->>'type' = 'gap_fill'
AND exercise.question_data->>'text' = '{gap}'
AND exercise.answer_data->'answers' @> '["tuo"]'::jsonb;
`);
},
async down() {
// Do not restore the context-free task.
}
};