feat(bisaya): update prompts and add migration for food context gap exercise
All checks were successful
Deploy to production / deploy (push) Successful in 3m28s

This commit is contained in:
Torsten Schulz (local)
2026-09-04 15:13:25 +02:00
parent 7edb9d79e5
commit 90686388c6
3 changed files with 34 additions and 4 deletions

View File

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

View File

@@ -616,9 +616,14 @@ function buildContextGapExercise(lesson, didactics, pattern) {
.split(/[.!?]+/) .split(/[.!?]+/)
.map((step) => step.trim()) .map((step) => step.trim())
.filter(Boolean); .filter(Boolean);
// A multi-step cue is already the concrete scenario. Do not reduce a const cueWordCount = scenarioCue
// route such as "Diretso. Tuo. Wala. Duol ra." to a bare direction word. .replace(/[.,?!]/g, ' ')
const gapTarget = scenarioSteps.length >= 2 .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 ? scenarioCue
: (scenarioPattern || pattern); : (scenarioPattern || pattern);
const gapExercise = buildGapExercise(lesson.title, gapTarget); const gapExercise = buildGapExercise(lesson.title, gapTarget);

View File

@@ -374,7 +374,7 @@ const LESSON_DIDACTICS = {
speakingPrompts: [ speakingPrompts: [
{ {
title: 'Auf dem Tisch', 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.' cue: 'Kan-on, isda ug tubig.'
} }
], ],