feat: verbessere SRS-Logik und füge serverseitige Zählung für fällige Items hinzu
Some checks failed
Deploy to production / deploy (push) Failing after 1m50s

This commit is contained in:
Torsten Schulz (local)
2026-06-03 16:39:12 +02:00
parent a4c053df3e
commit 8b0aa94715
2 changed files with 53 additions and 4 deletions

View File

@@ -928,6 +928,16 @@ export default class VocabService {
if (!reference || !learning) {
return;
}
// Heuristik: Vermeide, einzelne sehr kurze Ziel-Token (z.B. "ko")
// automatisch mit mehrwortigen Glosses (z.B. "Ich arbeite") zu koppeln.
// Das verhindert fehlerhafte Glosszuweisungen für Partikeln/Pronomina.
const compactRefLen = reference.replace(/\s+/g, '').length;
const learningWordCount = this._wordCount(learning);
if (compactRefLen <= 3 && learningWordCount > 1) {
return;
}
if (!glossByReference.has(reference)) {
glossByReference.set(reference, learning);
}
@@ -1885,6 +1895,11 @@ export default class VocabService {
const rows = validDueRows.slice(0, limit);
const totalDueCount = validDueRows.length;
// Debug: Logge Anzahl fälliger SRS-Items (nur in Entwicklung sichtbar)
try {
console.debug('[VocabService] getCourseSrsDue', { userId: user.id, courseId: course.id, totalDueCount });
} catch (_) {}
return {
courseId: course.id,
dueAt: now.toISOString(),
@@ -1992,6 +2007,18 @@ export default class VocabService {
}
await item.save();
// Debug: Logge SRS-Updates, damit wir sehen, ob Reviews ankommen
try {
console.debug('[VocabService] reviewSrsItem saved', {
userId: user.id,
courseId: courseId,
itemKey: item.itemKey,
correct: correct,
nextDueAt: this._normalizeIsoDate(item.nextDueAt),
stage: item.stage
});
} catch (_) {}
return {
itemKey: item.itemKey,
correct,