feat: verbessere die Pool-Aktualisierung, um SRS-Metadaten bei Verwendung eines initialen Pools abzurufen
All checks were successful
Deploy to production / deploy (push) Successful in 1m57s

This commit is contained in:
Torsten Schulz (local)
2026-06-04 17:28:06 +02:00
parent cb7ea317a3
commit 4754ae37da

View File

@@ -758,9 +758,24 @@ export default {
}, },
async reloadPool() { async reloadPool() {
if (!this.openParams) return; if (!this.openParams) return;
// If an initialPool was provided by the caller (e.g. course view passed the first page),
// use it immediately to populate the UI but still fetch the course-wide SRS metadata
// (totalDueCount and possibly the full item list) so the dialog can show accurate totals.
if (this.initialPool) { if (this.initialPool) {
this.loading = false; this.loading = false;
this.pool = this.normalizePool(this.initialPool); this.pool = this.normalizePool(this.initialPool);
// Try to fetch course-wide SRS info in this case as well so we know `srsServerTotalDue`.
if (this.openParams.courseId) {
try {
const courseDueRes = await apiClient.get(`/api/vocab/courses/${this.openParams.courseId}/srs/due`, { params: { limit: 500 } });
if (courseDueRes && Array.isArray(courseDueRes.data?.items) && courseDueRes.data.items.length > 0) {
this.srsServerTotalDue = Number.isFinite(Number(courseDueRes.data?.totalDueCount)) ? Number(courseDueRes.data.totalDueCount) : null;
}
} catch (_) {
// ignore; we keep initialPool as the displayed pool
}
}
if (this.srsMode) { if (this.srsMode) {
this.initSrsSessionFromPool(); this.initSrsSessionFromPool();
} }