From 4754ae37da11848baf63857efbebe9a131b6ec00 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Thu, 4 Jun 2026 17:28:06 +0200 Subject: [PATCH] feat: verbessere die Pool-Aktualisierung, um SRS-Metadaten bei Verwendung eines initialen Pools abzurufen --- .../socialnetwork/VocabPracticeDialog.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue index cd8cdb8..8988a9e 100644 --- a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue +++ b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue @@ -758,9 +758,24 @@ export default { }, async reloadPool() { 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) { this.loading = false; 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) { this.initSrsSessionFromPool(); }