Beispiel #1
0
def cadmin_exam_viewmarked(course_id, exam_id, student_uid):
    """  Show a student's marked assessment results """

    course = Courses2.get_course(course_id)
    try:
        exam = Exams.get_exam_struct(exam_id, course_id)
    except KeyError:
        exam = {}
        abort(404)
    results, examtotal = Assess.render_own_marked_exam(student_uid, exam_id)

    if examtotal is False:
        status = 0
    else:
        status = 1
    marktime = Exams.get_mark_time(exam_id, student_uid)
    firstview = Exams.get_student_start_time(exam_id, student_uid)
    submittime = Exams.get_submit_time(exam_id, student_uid)

    try:
        datemarked = General.human_date(marktime)
    except AttributeError:
        datemarked = None
    try:
        datefirstview = General.human_date(firstview)
    except AttributeError:
        datefirstview = None
    try:
        datesubmit = General.human_date(submittime)
    except AttributeError:
        datesubmit = None

    user = Users2.get_user(student_uid)

    if submittime and firstview:
        taken = submittime-firstview
        takenmins = (taken.seconds/60)
    else:
        takenmins = None

    return render_template(
        "cadmin_markedresult.html",
        course=course,
        exam=exam,
        results=results,
        examtotal=examtotal,
        datesubmit=datesubmit,
        datemarked=datemarked,
        datefirstview=datefirstview,
        taken=takenmins,
        user=user,
        status=status
    )
Beispiel #2
0
def cadmin_exam_viewmarked(course_id, exam_id, student_uid):
    """  Show a student's marked assessment results """

    course = Courses2.get_course(course_id)
    try:
        exam = Exams.get_exam_struct(exam_id, course_id)
    except KeyError:
        exam = {}
        abort(404)
    results, examtotal = Assess.render_own_marked_exam(student_uid, exam_id)

    if examtotal is False:
        status = 0
    else:
        status = 1
    marktime = Exams.get_mark_time(exam_id, student_uid)
    firstview = Exams.get_student_start_time(exam_id, student_uid)
    submittime = Exams.get_submit_time(exam_id, student_uid)

    try:
        datemarked = General.human_date(marktime)
    except AttributeError:
        datemarked = None
    try:
        datefirstview = General.human_date(firstview)
    except AttributeError:
        datefirstview = None
    try:
        datesubmit = General.human_date(submittime)
    except AttributeError:
        datesubmit = None

    user = Users2.get_user(student_uid)

    if submittime and firstview:
        taken = submittime - firstview
        takenmins = (taken.seconds / 60)
    else:
        takenmins = None

    return render_template("cadmin_markedresult.html",
                           course=course,
                           exam=exam,
                           results=results,
                           examtotal=examtotal,
                           datesubmit=datesubmit,
                           datemarked=datemarked,
                           datefirstview=datefirstview,
                           taken=takenmins,
                           user=user,
                           status=status)
Beispiel #3
0
def student_exam_duration(student, exam_id):
    """ How long did the assessment take.
        returns   starttime, endtime
        either could be None if it hasn't been started/finished
    """

    firstview = None

    examsubmit = Exams.get_submit_time(exam_id, student)
    questions = General.get_exam_qs(student, exam_id)

    # we're working out the first time the assessment was viewed is the
    # earliest time a question in it was viewed
    # It's possible (although unlikely) that they viewed a question
    # other than the first page, first.
    for question in questions:
        questionview = DB.get_q_viewtime(question)
        if firstview:
            if questionview < firstview:
                firstview = questionview
        else:
            firstview = questionview
    return firstview, examsubmit
Beispiel #4
0
def student_exam_duration(student, exam_id):
    """ How long did the assessment take.
        returns   starttime, endtime
        either could be None if it hasn't been started/finished
    """

    firstview = None

    examsubmit = Exams.get_submit_time(exam_id, student)
    questions = General.get_exam_qs(student, exam_id)

    # we're working out the first time the assessment was viewed is the
    # earliest time a question in it was viewed
    # It's possible (although unlikely) that they viewed a question
    # other than the first page, first.
    for question in questions:
        questionview = DB.get_q_viewtime(question)
        if firstview:
            if questionview < firstview:
                firstview = questionview
        else:
            firstview = questionview
    return firstview, examsubmit