From bd71ce6071e7b8d942e299debf432e2dcc2c927e Mon Sep 17 00:00:00 2001 From: Erza Bytyci Date: Mon, 28 Sep 2026 17:51:03 +0000 Subject: [PATCH] improve gap exercises --- gradesa/src/app/admin/create-exercise/fillinthegap/page.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gradesa/src/app/admin/create-exercise/fillinthegap/page.js b/gradesa/src/app/admin/create-exercise/fillinthegap/page.js index 4aedce0..d3d30a7 100644 --- a/gradesa/src/app/admin/create-exercise/fillinthegap/page.js +++ b/gradesa/src/app/admin/create-exercise/fillinthegap/page.js @@ -333,12 +333,16 @@ export default function CreateFillInTheGapExercisePage() { setError(""); try { + // Re-derive token_index from the current tokenization on every save so legacy + // exercises self-heal instead of persisting stale indices from older tokenizers. + const healedGaps = remapGapsToTokens(gaps, tokens); + const payload = { title, instructionText, text, textHtml, - gaps, + gaps: healedGaps, }; if (isEditMode) {