コード例 #1
0
def should_send_proctoring_requirements_email(username, course_id):
    """
    Returns a boolean whether a proctoring requirements email should be sent.

    Arguments:
        * username (str): The user associated with the enrollment.
        * course_id (str): The course id associated with the enrollment.
    """
    if not is_enrollment_valid_for_proctoring(username, course_id):
        return False

    # Only send if a proctored exam is found in the course
    timed_exams = modulestore().get_items(
        course_id,
        qualifiers={'category': 'sequential'},
        settings={'is_time_limited': True})

    has_proctored_exam = any(exam.is_proctored_exam for exam in timed_exams)

    return has_proctored_exam
コード例 #2
0
def is_track_ok_for_exam(user, exam):
    """
    Returns whether the user is in an appropriate enrollment mode
    """
    course_id = CourseKey.from_string(exam['course_id'])
    return is_enrollment_valid_for_proctoring(user.username, course_id)