13,689 new quiz questions in 160 practice islands (grades 3-12), Question.figure, replay rotates the quiz, LaTeX removed from lesson/question text

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 11:58:18 +03:30
parent f9eea56895
commit dd10ff83f4
14 changed files with 259891 additions and 640 deletions

View File

@@ -589,6 +589,7 @@ class LessonQuestionsView(APIView):
'type': q.type,
'prompt': q.prompt,
'options': [{'id': str(c.id), 'value': c.value} for c in q.choices.all()],
'figure': q.figure,
}
for q in questions
]}
@@ -1035,7 +1036,15 @@ class NodeQuizView(APIView):
# درهم‌ریزیِ پایدار: همان کاربر روی همان مبحث همیشه همان ترتیب را
# می‌بیند، ولی دو کاربرِ مختلف دو ترتیبِ مختلف.
seed = request.query_params.get('seed') or str(getattr(request.user, 'id', '') or '')
rng = random.Random(f'{node_id}:{seed}')
# دوباره‌بازیِ همان جزیره آزمونِ تازه می‌دهد: شمارِ آزمون‌های تمام‌شده‌ی این کاربر روی این
# جزیره در مبنای درهم‌ریزی می‌آید. تا پایانِ آزمون عدد ثابت است، پس رفرش همان آزمون را
# می‌دهد. با استخرِ یک‌سوال‌به‌درس عملاً چیزی عوض نمی‌شود؛ معنی‌اش با استخرِ بزرگ پیداست.
# فقط برای کاربرِ واردشده و بی‌`?seed=`؛ نسنجیده: اثرش روی کشِ فرانت.
rounds = 0
if not request.query_params.get('seed') and getattr(request.user, 'id', None):
rounds = UserNodeCompletion.objects.filter(
user_id=request.user.id, node_id=node_id).count()
rng = random.Random(f'{node_id}:{seed}:{rounds}' if rounds else f'{node_id}:{seed}')
rng.shuffle(questions)
# حداکثر یک سوال از هر درس تا آزمون روی یک مهارت گیر نکند؛ اگر با این
@@ -1069,6 +1078,7 @@ class NodeQuizView(APIView):
'lessonTitle': q.lesson.title,
'type': q.type,
'prompt': q.prompt,
'figure': q.figure,
'options': [
{'id': str(c.pk), 'value': c.value} for c in q.choices.all()
],