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:
@@ -231,3 +231,37 @@ class NodeQuizCompleteTests(TestCase):
|
||||
|
||||
self.assertEqual(body['stats']['progressPercent'], 10.0) # ۱ از ۱۰ درس
|
||||
self.assertTrue(UserLessonCompletion.objects.filter(user_id=self.user.id).exists())
|
||||
|
||||
|
||||
class NodeQuizRotationTests(TestCase):
|
||||
"""دوبارهبازیِ یک جزیره آزمونِ تازه میدهد؛ رفرش تا پایانِ آزمون همان را میدهد."""
|
||||
|
||||
def setUp(self):
|
||||
cache.clear()
|
||||
grade = Grade.objects.create(title='پایه نهم', icon='', color='')
|
||||
unit = Unit.objects.create(grade=grade, title='فصل ۱', order=1)
|
||||
self.node = Node.objects.create(unit=unit, title='اول', order=1)
|
||||
for i in range(4):
|
||||
lesson = Lesson.objects.create(node=self.node, title=f'درس {i}')
|
||||
for j in range(12):
|
||||
question = Question.objects.create(
|
||||
lesson=lesson, type='multiple_choice', prompt=f'سوال {i}-{j}')
|
||||
Choice.objects.create(question=question, value='الف', is_correct=True)
|
||||
Choice.objects.create(question=question, value='ب', is_correct=False)
|
||||
self.user = User.objects.create(phone='09120000019', grade_id=grade.id)
|
||||
self.auth = {'HTTP_AUTHORIZATION': f'Bearer {issue_access_token(self.user.id)}'}
|
||||
|
||||
def _ids(self):
|
||||
body = self.client.get(f'/api/nodes/{self.node.pk}/quiz', **self.auth).json()
|
||||
return [q['id'] for q in body['questions']]
|
||||
|
||||
def test_refresh_keeps_the_quiz_until_it_is_completed(self):
|
||||
self.assertEqual(self._ids(), self._ids())
|
||||
|
||||
def test_each_completed_round_draws_a_fresh_quiz(self):
|
||||
first = self._ids()
|
||||
UserNodeCompletion.objects.create(
|
||||
user_id=self.user.id, node=self.node, correct_count=4, total_questions=4, stars=3)
|
||||
second = self._ids()
|
||||
self.assertNotEqual(first, second)
|
||||
self.assertEqual(second, self._ids())
|
||||
|
||||
Reference in New Issue
Block a user