def test_simple_course(self): course_1 = list(Solution.status(course_id=self.course1.id).dicts()) course_2 = list(Solution.status(course_id=self.course2.id).dicts()) assert len(course_1) == 2 assert len(course_2) == 1 ex1_1 = next(filter(lambda e: e['id'] == self.ex1_1.id, course_1)) ex1_2 = next(filter(lambda e: e['id'] == self.ex1_2.id, course_1)) ex2_1 = next(filter(lambda e: e['id'] == self.ex2_1.id, course_2)) assert ex1_1['submitted'] == 2 assert ex1_2['submitted'] == 1 assert ex2_1['submitted'] == 1
def test_all_together(self): all_courses = list(Solution.status().dicts()) assert len(all_courses) == 3 ex1_1 = next(filter(lambda e: e['id'] == self.ex1_1.id, all_courses)) ex1_2 = next(filter(lambda e: e['id'] == self.ex1_2.id, all_courses)) ex2_1 = next(filter(lambda e: e['id'] == self.ex2_1.id, all_courses)) assert ex1_1['submitted'] == 2 assert ex1_2['submitted'] == 1 assert ex2_1['submitted'] == 1
def status(): return render_template( 'status.html', exercises=Solution.status(), )
def test_no_exercises(self): submissions = list(Solution.status(self.course_no_exercises).dicts()) assert not submissions
def status(course_id: int): return render_template( 'status.html', exercises=Solution.status(course_id), )