Fix CBT session isolation and backend seed mock data exam pattern

This commit is contained in:
2026-09-21 12:15:13 +05:30
parent 63ab119f7c
commit 857ac320f1
3 changed files with 19 additions and 9 deletions

View File

@@ -457,9 +457,12 @@ def seed_local_database():
subject = raw_questions[0].get("subject", "General") if raw_questions else "General"
topic = raw_questions[0].get("topic", "Chapter 4") if raw_questions else "Chapter 4"
sheet_title = f"{subject} — {topic} DPS"
sheet_title = f"{subject} DPS"
sheet_date = date.today() - timedelta(days=i)
is_neet = any(s in subject.lower() for s in ["botany", "zoology", "bio", "biology"])
dps_pattern = models.ExamEnum.NEET if is_neet else models.ExamEnum.JEE_MAIN
# Create Question records from the JSON
q_ids = []
for raw_q in raw_questions:
@@ -475,7 +478,7 @@ def seed_local_database():
correct_answer=raw_q.get("correct_answer", {"value": "A"}),
solution_text=raw_q.get("solution_text", "Refer to standard solution."),
language=models.MediumEnum.ENGLISH,
exam=models.ExamEnum.JEE_MAIN,
exam=dps_pattern,
created_by=admin_id,
)
dps_session.add(q)
@@ -499,7 +502,7 @@ def seed_local_database():
id=dps_id,
title=sheet_title,
type="DPS",
exam_pattern=models.ExamEnum.JEE_MAIN,
exam_pattern=dps_pattern,
sections={"Practice": {"questions": q_ids, "time_limit": 30}},
total_time=30,
difficulty="Medium",
@@ -519,3 +522,4 @@ def seed_local_database():
if __name__ == "__main__":
seed_local_database()