Fix: reprocess button works after session resume + apply merge logic
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 45s
CI / test-go-edu-search (push) Successful in 46s
CI / test-python-klausur (push) Failing after 2m37s
CI / test-python-agent-core (push) Successful in 34s
CI / test-nodejs-website (push) Successful in 34s

Two bugs fixed:
1. reprocessPages() failed silently after session resume because
   successfulPages was empty. Now derives pages from vocabulary
   source_page or selectedPages as fallback.

2. process-single-page endpoint built vocabulary entries WITHOUT
   applying merge logic (_merge_wrapped_rows, _merge_continuation_rows).
   Now applies full merge pipeline after vocabulary extraction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-17 00:46:15 +02:00
parent 46c2acb2f4
commit 9b0e310978
2 changed files with 60 additions and 2 deletions

View File

@@ -760,11 +760,28 @@ export function useVocabWorksheet(): VocabWorksheetHook {
// Reprocess all successful pages with new IPA/syllable modes
const reprocessPages = (ipa: IpaMode, syllable: SyllableMode) => {
if (!session || successfulPages.length === 0) return
if (!session) return
// Determine pages to reprocess: use successfulPages if available,
// otherwise derive from vocabulary source_page or selectedPages
let pagesToReprocess: number[]
if (successfulPages.length > 0) {
pagesToReprocess = successfulPages.map(p => p - 1)
} else if (vocabulary.length > 0) {
// Derive from vocabulary entries' source_page (1-indexed → 0-indexed)
const pageSet = new Set(vocabulary.map(v => (v.source_page || 1) - 1))
pagesToReprocess = [...pageSet].sort((a, b) => a - b)
} else if (selectedPages.length > 0) {
pagesToReprocess = [...selectedPages]
} else {
// Fallback: try page 0
pagesToReprocess = [0]
}
if (pagesToReprocess.length === 0) return
setIsExtracting(true)
setExtractionStatus('Verarbeite mit neuen Einstellungen...')
const pagesToReprocess = successfulPages.map(p => p - 1)
const API_BASE = getApiBase()
;(async () => {