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
This commit is contained in:
parent
e7e64ad2ed
commit
c648c6668b
|
|
@ -324,12 +324,15 @@ export function SpeakingPage() {
|
||||||
all.map(async (practice) => {
|
all.map(async (practice) => {
|
||||||
try {
|
try {
|
||||||
const res = await getPracticeQuestionsByPractice(practice.id, {
|
const res = await getPracticeQuestionsByPractice(practice.id, {
|
||||||
limit: 1,
|
limit: 20,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
question_type: "AUDIO",
|
question_type: "AUDIO",
|
||||||
})
|
})
|
||||||
const total = res.data?.data?.total_count ?? 0
|
const questions = res.data?.data?.questions ?? []
|
||||||
return total > 0 ? practice : null
|
const hasAudioQuestion = questions.some(
|
||||||
|
(question) => (question.question_type ?? "").toUpperCase() === "AUDIO",
|
||||||
|
)
|
||||||
|
return hasAudioQuestion ? practice : null
|
||||||
} catch {
|
} catch {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user