Compare commits

..

No commits in common. "c648c6668bc404426d5fe13330d10e359cf6d7df" and "2fcf2b47b08f6b9000cceb6dddfc1a412f762879" have entirely different histories.

View File

@ -319,29 +319,8 @@ export function SpeakingPage() {
if (chunk.length < batchSize) break
offset += chunk.length
}
// Speaking page should only offer practices that already contain AUDIO questions.
const checks = await Promise.all(
all.map(async (practice) => {
try {
const res = await getPracticeQuestionsByPractice(practice.id, {
limit: 20,
offset: 0,
question_type: "AUDIO",
})
const questions = res.data?.data?.questions ?? []
const hasAudioQuestion = questions.some(
(question) => (question.question_type ?? "").toUpperCase() === "AUDIO",
)
return hasAudioQuestion ? practice : null
} catch {
return null
}
}),
)
const speakingPractices = checks.filter((p): p is QuestionSet => p !== null)
setPracticeOptions(
speakingPractices.map((p) => ({
all.map((p) => ({
id: p.id,
title: p.title,
})),
@ -354,12 +333,6 @@ export function SpeakingPage() {
})
}, [fetchPracticeOptions])
useEffect(() => {
if (!selectedPracticeId) return
const exists = practiceOptions.some((option) => option.id === Number(selectedPracticeId))
if (!exists) setSelectedPracticeId("")
}, [practiceOptions, selectedPracticeId])
useEffect(() => {
let cancelled = false
const fetchSubCourseOptions = async () => {