def add_lesson_completed(user_id): student = StudentProfile.objects.get(user_id=user_id) try: lesson = Lesson.objects.get(id=student.next_lesson_id) student.completed_lessons.add(lesson) get_next_lesson(student.user_id) except Lesson.DoesNotExist: pass
def test_go_back_level_and_continue_lessons_again(self): get_level(7) get_next_lesson(7) self.assertEqual(StudentProfile.objects.get(user_id=7).level, 1) self.assertEqual( StudentProfile.objects.get(user_id=7).next_lesson_id, 1)
def test_go_back_level_and_continue_lessons1(self): get_level(5) get_next_lesson(5) self.assertEqual(StudentProfile.objects.get(user_id=5).level, 1) self.assertEqual( StudentProfile.objects.get(user_id=5).next_lesson_id, 2)
def test_go_back_level_and_continue_lessons2(self): get_level(6) get_next_lesson(6) self.assertEqual(StudentProfile.objects.get(user_id=6).level, 2) self.assertEqual( StudentProfile.objects.get(user_id=6).next_lesson_id, 5)
def test_go_back_level_delete_completed_levels(self): get_level(4) get_next_lesson(4) self.assertEqual(StudentProfile.objects.get(user_id=4).level, 1) self.assertEqual( StudentProfile.objects.get(user_id=4).next_lesson_id, 1)