diff --git a/backend/main.py b/backend/main.py index b9b115f..2b12a9d 100644 --- a/backend/main.py +++ b/backend/main.py @@ -646,6 +646,7 @@ class ManualQuestionInput(BaseModel): class ManualTestCreate(BaseModel): title: str + type: str = "CBT" exam_pattern: str time_limit: int scheduled_date: Optional[datetime] = None @@ -707,7 +708,7 @@ def create_manual_test( # 1. Create the test object test_obj = models.Test( title=data.title, - type="Mock", + type=data.type, exam_pattern=models.ExamEnum(data.exam_pattern), sections={}, total_time=data.time_limit, diff --git a/src/app/admin/tests/page.tsx b/src/app/admin/tests/page.tsx index 221e622..67e89bd 100644 --- a/src/app/admin/tests/page.tsx +++ b/src/app/admin/tests/page.tsx @@ -41,6 +41,7 @@ export default function AdminTestsPage() { // Upload Form State const [title, setTitle] = useState("") + const [testType, setTestType] = useState("CBT") const [examPattern, setExamPattern] = useState("JEE_Main") const [timeLimit, setTimeLimit] = useState("180") const [scheduledDate, setScheduledDate] = useState(null) @@ -180,6 +181,7 @@ export default function AdminTestsPage() { const payload = { title, + type: testType, exam_pattern: examPattern, time_limit: parseInt(timeLimit), admin_id: userId, @@ -236,6 +238,27 @@ export default function AdminTestsPage() { setTitle(e.target.value)} placeholder="e.g. JEE Main Mock Test 1" /> + + {/* TEST TYPE — KEY DIFFERENTIATOR */} +
+ + +

+ {testType === 'CBT' + ? '✅ This will appear under Dashboard → Mock Tests (CBT) for students to attempt.' + : '✅ This will appear under AI Coach → PrepPilot AI as a DPP with full CBT interface.'} +

+
diff --git a/src/app/cbt/[examId]/page.tsx b/src/app/cbt/[examId]/page.tsx index ceba32d..ba37c44 100644 --- a/src/app/cbt/[examId]/page.tsx +++ b/src/app/cbt/[examId]/page.tsx @@ -316,6 +316,7 @@ export default function CBTExamPage({ params }: { params: Promise<{ examId: stri { resetExamState(); window.location.reload(); diff --git a/src/app/dashboard/cbt/history/[attemptId]/page.tsx b/src/app/dashboard/cbt/history/[attemptId]/page.tsx index 0979f55..848854d 100644 --- a/src/app/dashboard/cbt/history/[attemptId]/page.tsx +++ b/src/app/dashboard/cbt/history/[attemptId]/page.tsx @@ -62,6 +62,10 @@ export default function AttemptHistoryPage({ params }: { params: Promise<{ attem fetchHistoryData(); }, [attemptId, userId]); + // Smart back route based on test type + const backRoute = test?.type === 'DPS' ? '/dashboard/ai-coach/cbt-dpp' : '/dashboard/cbt'; + const backLabel = test?.type === 'DPS' ? '← Back to PrepPilot AI' : '← Back to Tests'; + if (loading) { return (
@@ -83,8 +87,8 @@ export default function AttemptHistoryPage({ params }: { params: Promise<{ attem return (
- - Back to Tests + + {test?.type === 'DPS' ? 'Back to PrepPilot AI' : 'Back to Tests'}
diff --git a/src/components/CBT/ExamResult.tsx b/src/components/CBT/ExamResult.tsx index 4b23836..e33878c 100644 --- a/src/components/CBT/ExamResult.tsx +++ b/src/components/CBT/ExamResult.tsx @@ -19,11 +19,15 @@ interface ExamAttemptPayload { interface ExamResultProps { payload: ExamAttemptPayload; attemptId: string | null; + examType?: string; // 'CBT' or 'DPS' onRetake: () => void; } -export function ExamResult({ payload, attemptId, onRetake }: ExamResultProps) { +export function ExamResult({ payload, attemptId, examType, onRetake }: ExamResultProps) { const router = useRouter(); + const isDPP = examType === 'DPS'; + const backRoute = isDPP ? '/dashboard/ai-coach/cbt-dpp' : '/dashboard/cbt'; + const backLabel = isDPP ? 'Back to PrepPilot AI' : 'Back to Mock Tests'; const answered = payload.answers.filter(a => a.selected_answer !== null).length; const unanswered = payload.total_questions - answered; @@ -114,7 +118,7 @@ export function ExamResult({ payload, attemptId, onRetake }: ExamResultProps) {
{attemptId && (