Esempio n. 1
0
    def test_start_checking(exercise: Exercise, student_user: User):
        student_user2 = conftest.create_student_user(index=1)
        exercise2 = conftest.create_exercise(1)
        solution1 = conftest.create_solution(exercise, student_user)
        solution2 = conftest.create_solution(exercise2, student_user)
        solution3 = conftest.create_solution(exercise, student_user2)

        is_checking = solutions.start_checking(solution=None)
        assert not is_checking

        with no_celery:
            for solution in (solution1, solution2, solution3):
                assert solution.state == Solution.STATES.CREATED.name
                is_checking = solutions.start_checking(solution=solution)
                assert is_checking
                the_solution = Solution.get_by_id(solution.id)
                assert the_solution.state == Solution.STATES.IN_CHECKING.name
Esempio n. 2
0
def start_checking(exercise_id):
    next_solution = solutions.get_next_unchecked(exercise_id)
    if solutions.start_checking(next_solution):
        return redirect(f'{routes.SOLUTIONS}/{next_solution.id}')
    return redirect(routes.STATUS)