From 90686388c65a0e873b4264762190de8d71a12279 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 4 Sep 2026 15:13:25 +0200 Subject: [PATCH] feat(bisaya): update prompts and add migration for food context gap exercise --- ...4000000-repair-bisaya-food-context-gap.cjs | 25 +++++++++++++++++++ .../scripts/create-bisaya-course-content.js | 11 +++++--- backend/scripts/create-bisaya-course.js | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 backend/migrations-active/20260904000000-repair-bisaya-food-context-gap.cjs diff --git a/backend/migrations-active/20260904000000-repair-bisaya-food-context-gap.cjs b/backend/migrations-active/20260904000000-repair-bisaya-food-context-gap.cjs new file mode 100644 index 0000000..b82aca4 --- /dev/null +++ b/backend/migrations-active/20260904000000-repair-bisaya-food-context-gap.cjs @@ -0,0 +1,25 @@ +'use strict'; + +/** Replaces a context-free food gap with a clearly answerable table setting. */ +module.exports = { + async up(queryInterface) { + await queryInterface.sequelize.query(` + UPDATE community.vocab_grammar_exercise AS exercise + SET title = 'Essen & Trinken: Auf dem Tisch ergänzen', + instruction = 'Auf dem Tisch stehen Reis, Fisch und Wasser. Ergänze das fehlende Bisaya-Wort.', + question_data = '{"type":"gap_fill","text":"{gap}, isda ug tubig.","gaps":1}'::jsonb, + answer_data = '{"type":"gap_fill","answers":["Kan-on"]}'::jsonb, + explanation = 'Kan-on bedeutet gekochter Reis. Der ganze Ausdruck lautet: „Kan-on, isda ug tubig.“' + FROM community.vocab_course_lesson AS lesson + WHERE exercise.lesson_id = lesson.id + AND lesson.lesson_number = 8 + AND lesson.title = 'Essen & Trinken' + AND exercise.exercise_number = 3 + AND exercise.title = 'Essen & Trinken: Kernmuster ergänzen'; + `); + }, + + async down() { + // Do not restore the ambiguous exercise. + } +}; diff --git a/backend/scripts/create-bisaya-course-content.js b/backend/scripts/create-bisaya-course-content.js index 944770c..cd4a9ee 100755 --- a/backend/scripts/create-bisaya-course-content.js +++ b/backend/scripts/create-bisaya-course-content.js @@ -616,9 +616,14 @@ function buildContextGapExercise(lesson, didactics, pattern) { .split(/[.!?]+/) .map((step) => step.trim()) .filter(Boolean); - // A multi-step cue is already the concrete scenario. Do not reduce a - // route such as "Diretso. Tuo. Wala. Duol ra." to a bare direction word. - const gapTarget = scenarioSteps.length >= 2 + const cueWordCount = scenarioCue + .replace(/[.,?!]/g, ' ') + .split(/\s+/) + .filter(Boolean) + .length; + // A multi-step cue or a short word sequence is already the concrete + // scenario. Do not reduce a route or a table setting to a bare word. + const gapTarget = scenarioSteps.length >= 2 || cueWordCount >= 3 ? scenarioCue : (scenarioPattern || pattern); const gapExercise = buildGapExercise(lesson.title, gapTarget); diff --git a/backend/scripts/create-bisaya-course.js b/backend/scripts/create-bisaya-course.js index 18d69a9..f47fd0e 100755 --- a/backend/scripts/create-bisaya-course.js +++ b/backend/scripts/create-bisaya-course.js @@ -374,7 +374,7 @@ const LESSON_DIDACTICS = { speakingPrompts: [ { title: 'Auf dem Tisch', - prompt: 'Nenne drei Dinge, die auf dem Tisch stehen oder die du essen und trinken möchtest.', + prompt: 'Auf dem Tisch stehen Reis, Fisch und Wasser. Ergänze das fehlende Bisaya-Wort.', cue: 'Kan-on, isda ug tubig.' } ],