diff --git a/backend/main.py b/backend/main.py index 4446d69..fb4f339 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1342,14 +1342,15 @@ async def upload_admin_test( test_obj = models.Test( title=title, - type="Mock", + type="DPS", exam_pattern=models.ExamEnum(exam_pattern), sections={}, total_time=time_limit, difficulty="Medium", scheduled_date=scheduled_date, is_active=False, - created_by=admin_id + created_by=admin_id, + pdf_url=url ) session.add(test_obj) session.commit() diff --git a/backend/models.py b/backend/models.py index e13e550..027b6a1 100644 --- a/backend/models.py +++ b/backend/models.py @@ -121,6 +121,7 @@ class Test(SQLModel, table=True): end_date: Optional[datetime] = None is_active: bool = Field(default=True) created_by: UUID + pdf_url: Optional[str] = None class Transaction(SQLModel, table=True): id: UUID = Field(default_factory=uuid4, primary_key=True) diff --git a/src/app/dashboard/dpp/page.tsx b/src/app/dashboard/dpp/page.tsx index 935fbe3..1201bca 100644 --- a/src/app/dashboard/dpp/page.tsx +++ b/src/app/dashboard/dpp/page.tsx @@ -1,4 +1,4 @@ -"use client" +"use client" import { fetchWithAuth } from "@/lib/apiClient"; import { Button } from "@/components/ui/button" @@ -197,8 +197,12 @@ export default function AIDailyPracticePage() {
{isUpcoming ? ( - ) : isExpired && !isAttempted ? ( + ) : isExpired && !isAttempted && !dpp.pdf_url ? ( + ) : dpp.pdf_url ? ( + ) : isAttempted ? ( <> @@ -298,7 +302,7 @@ export default function AIDailyPracticePage() { style={{minHeight: isFullScreen ? 'calc(100vh - 120px)' : '75vh'}} >