Fix test filtering by exam_pattern, fix Admin UI test upload mapping Mock/DPS
This commit is contained in:
@@ -446,9 +446,14 @@ def list_active_tests(exam_pattern: Optional[str] = None, type: Optional[str] =
|
|||||||
if exam_pattern == 'JEE_NEET':
|
if exam_pattern == 'JEE_NEET':
|
||||||
pass
|
pass
|
||||||
elif exam_pattern == 'JEE':
|
elif exam_pattern == 'JEE':
|
||||||
query = query.where(models.Test.exam_pattern.in_(['JEE_Main', 'JEE_Advanced']))
|
query = query.where(models.Test.exam_pattern.in_([models.ExamEnum.JEE_MAIN, models.ExamEnum.JEE_ADVANCED]))
|
||||||
else:
|
else:
|
||||||
query = query.where(models.Test.exam_pattern == exam_pattern)
|
try:
|
||||||
|
# Find matching enum by value string (e.g. "JEE_Main")
|
||||||
|
enum_val = models.ExamEnum(exam_pattern)
|
||||||
|
query = query.where(models.Test.exam_pattern == enum_val)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
if type:
|
if type:
|
||||||
query = query.where(models.Test.type == type)
|
query = query.where(models.Test.type == type)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default function AdminTestsPage() {
|
|||||||
|
|
||||||
// Upload Form State
|
// Upload Form State
|
||||||
const [title, setTitle] = useState("")
|
const [title, setTitle] = useState("")
|
||||||
const [testType, setTestType] = useState("CBT")
|
const [testType, setTestType] = useState("Mock")
|
||||||
const [examPattern, setExamPattern] = useState("JEE_Main")
|
const [examPattern, setExamPattern] = useState("JEE_Main")
|
||||||
const [timeLimit, setTimeLimit] = useState("180")
|
const [timeLimit, setTimeLimit] = useState("180")
|
||||||
const [scheduledDate, setScheduledDate] = useState<Date | null>(null)
|
const [scheduledDate, setScheduledDate] = useState<Date | null>(null)
|
||||||
@@ -290,13 +290,13 @@ export default function AdminTestsPage() {
|
|||||||
value={testType}
|
value={testType}
|
||||||
onChange={(e) => setTestType(e.target.value)}
|
onChange={(e) => setTestType(e.target.value)}
|
||||||
>
|
>
|
||||||
<option value="CBT">🎯 CBT Test (JSON) — appears in Mock Tests section</option>
|
<option value="Mock">🎯 CBT Test (JSON) — appears in Mock Tests section</option>
|
||||||
<option value="PREP_PILOT">🤖 Prep Pilot Test (as CBT JSON) — appears in AI Coach</option>
|
<option value="DPS">🤖 Prep Pilot Test (as CBT JSON) — appears in AI Coach</option>
|
||||||
<option value="DPP_PDF">📋 DPP PDF (Minio Upload) — Class/Plan aligned</option>
|
<option value="DPP_PDF">📋 DPP PDF (Minio Upload) — Class/Plan aligned</option>
|
||||||
</select>
|
</select>
|
||||||
<p className="text-[11px] text-muted-foreground">
|
<p className="text-[11px] text-muted-foreground">
|
||||||
{testType === 'CBT' && '✅ Purely for CBT. Appears under Dashboard → Mock Tests.'}
|
{testType === 'Mock' && '✅ Purely for CBT. Appears under Dashboard → Mock Tests.'}
|
||||||
{testType === 'PREP_PILOT' && '✅ Purely for CBT. Appears under AI Coach → PrepPilot AI.'}
|
{testType === 'DPS' && '✅ Purely for CBT. Appears under AI Coach → PrepPilot AI.'}
|
||||||
{testType === 'DPP_PDF' && '✅ Uploads a PDF to Minio storage for Class/Plan aligned DPP.'}
|
{testType === 'DPP_PDF' && '✅ Uploads a PDF to Minio storage for Class/Plan aligned DPP.'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user