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) => {
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user