feat: verbessere SRS-Logik zur Bestimmung des nächsten Fälligkeitsdatums für neu erstellte Elemente und erweitere die API-Anfragen für kursweite fällige Items
All checks were successful
Deploy to production / deploy (push) Successful in 2m6s
All checks were successful
Deploy to production / deploy (push) Successful in 2m6s
This commit is contained in:
@@ -768,10 +768,12 @@ export default {
|
||||
let res = null;
|
||||
let courseDueRes = null;
|
||||
|
||||
// Wenn SRS-Modus auf Kurs-Ebene, lade kursweite fällige Items (Server liefert totalDueCount)
|
||||
if (this.srsMode && this.openParams.courseId && !this.openParams.lessonId) {
|
||||
// Wenn SRS-Modus und courseId vorhanden, frage kursweite fällige Items an (Server liefert totalDueCount).
|
||||
// Wir fragen das immer an, auch wenn gerade eine lessonId gesetzt ist, und nutzen es als Fallback
|
||||
// falls kein lesson-spezifischer Pool gefunden wird.
|
||||
if (this.srsMode && this.openParams.courseId) {
|
||||
try {
|
||||
courseDueRes = await apiClient.get(`/api/vocab/courses/${this.openParams.courseId}/srs/due`, { params: { limit: 100 } });
|
||||
courseDueRes = await apiClient.get(`/api/vocab/courses/${this.openParams.courseId}/srs/due`, { params: { limit: 500 } });
|
||||
} catch (err) {
|
||||
courseDueRes = null;
|
||||
}
|
||||
@@ -786,6 +788,36 @@ export default {
|
||||
lessonId: it.lessonId || null
|
||||
})));
|
||||
this.srsServerTotalDue = Number.isFinite(Number(courseDueRes.data?.totalDueCount)) ? Number(courseDueRes.data.totalDueCount) : null;
|
||||
}
|
||||
|
||||
// Wenn wir eine lessonId haben, versuche zuerst lesson-spezifische Vocabs zu laden.
|
||||
// Falls diese leer sind, und kursweite SRS-Items vorliegen, nutze diese als Fallback.
|
||||
if (this.openParams.lessonId) {
|
||||
try {
|
||||
if (this.allVocabs && this.openParams.courseId) {
|
||||
res = await apiClient.get(`/api/vocab/courses/${this.openParams.courseId}/completed-lesson-vocabs`, {
|
||||
params: { untilLessonId: this.openParams.lessonId }
|
||||
});
|
||||
this.pool = this.normalizePool(res.data?.vocabs || []);
|
||||
} else {
|
||||
res = await apiClient.get(`/api/vocab/lessons/${this.openParams.lessonId}/vocab-pool`);
|
||||
this.pool = this.normalizePool(res.data?.vocabs || []);
|
||||
}
|
||||
} catch (err) {
|
||||
res = null;
|
||||
this.pool = [];
|
||||
}
|
||||
|
||||
// Fallback auf kursweite SRS-Items, falls keine lesson-spezifischen Items vorhanden sind
|
||||
if ((!this.pool || this.pool.length === 0) && courseDueRes && Array.isArray(courseDueRes.data?.items) && courseDueRes.data.items.length > 0) {
|
||||
this.pool = this.normalizePool((courseDueRes.data.items || []).map((it) => ({
|
||||
id: it.itemKey,
|
||||
learning: it.learning,
|
||||
reference: it.reference,
|
||||
lessonId: it.lessonId || null
|
||||
})));
|
||||
this.srsServerTotalDue = Number.isFinite(Number(courseDueRes.data?.totalDueCount)) ? Number(courseDueRes.data.totalDueCount) : null;
|
||||
}
|
||||
} else {
|
||||
// Fallback: lade Lehr- bzw. Kapitel-/Kurs-Vokabeln
|
||||
if (this.openParams.lessonId) {
|
||||
|
||||
Reference in New Issue
Block a user