From c648c6668bc404426d5fe13330d10e359cf6d7df Mon Sep 17 00:00:00 2001 From: Yared Yemane Date: Tue, 7 Apr 2026 04:28:22 -0700 Subject: [PATCH] refine speaking practice filter to inspect audio rows Filter speaking practice options using returned AUDIO question rows instead of total_count so unrelated practices are excluded reliably. Made-with: Cursor --- src/pages/content-management/SpeakingPage.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/content-management/SpeakingPage.tsx b/src/pages/content-management/SpeakingPage.tsx index 34a4bf3..daecc2c 100644 --- a/src/pages/content-management/SpeakingPage.tsx +++ b/src/pages/content-management/SpeakingPage.tsx @@ -324,12 +324,15 @@ export function SpeakingPage() { all.map(async (practice) => { try { const res = await getPracticeQuestionsByPractice(practice.id, { - limit: 1, + limit: 20, offset: 0, question_type: "AUDIO", }) - const total = res.data?.data?.total_count ?? 0 - return total > 0 ? practice : null + const questions = res.data?.data?.questions ?? [] + const hasAudioQuestion = questions.some( + (question) => (question.question_type ?? "").toUpperCase() === "AUDIO", + ) + return hasAudioQuestion ? practice : null } catch { return null }