Beispiel #1
0
def grade(student,
          request,
          course,
          keep_raw_scores=False,
          field_data_cache=None,
          scores_client=None):
    """
    Returns the grade of the student.

    Also sends a signal to update the minimum grade requirement status.
    """
    grade_summary = _grade(student, request, course, keep_raw_scores,
                           field_data_cache, scores_client)
    responses = GRADES_UPDATED.send_robust(sender=None,
                                           username=student.username,
                                           grade_summary=grade_summary,
                                           course_key=course.id,
                                           deadline=course.end)

    for receiver, response in responses:
        log.info(
            'Signal fired when student grade is calculated. Receiver: %s. Response: %s',
            receiver, response)

    return grade_summary
Beispiel #2
0
def grade(student,
          request,
          course,
          keep_raw_scores=False,
          field_data_cache=None,
          scores_client=None):
    """
    Wraps "_grade" with the manual_transaction context manager just in case
    there are unanticipated errors.
    Send a signal to update the minimum grade requirement status.
    """
    with manual_transaction():
        grade_summary = course.grading.grade(student, request, course,
                                             keep_raw_scores, field_data_cache,
                                             scores_client)
        responses = GRADES_UPDATED.send_robust(sender=None,
                                               username=request.user.username,
                                               grade_summary=grade_summary,
                                               course_key=course.id,
                                               deadline=course.end)

        for receiver, response in responses:
            log.info(
                'Signal fired when student grade is calculated. Receiver: %s. Response: %s',
                receiver, response)

        return grade_summary
Beispiel #3
0
    def _signal_listeners_when_grade_computed(self):
        """
        Signal all listeners when grades are computed.
        """
        responses = GRADES_UPDATED.send_robust(sender=None,
                                               user=self.student,
                                               grade_summary=self.summary,
                                               course_key=self.course.id,
                                               deadline=self.course.end)

        for receiver, response in responses:
            log.info(
                'Signal fired when student grade is calculated. Receiver: %s. Response: %s',
                receiver, response)
Beispiel #4
0
    def _signal_listeners_when_grade_computed(self):
        """
        Signal all listeners when grades are computed.
        """
        responses = GRADES_UPDATED.send_robust(
            sender=None,
            user=self.student,
            grade_summary=self.summary,
            course_key=self.course.id,
            deadline=self.course.end,
        )

        for receiver, response in responses:
            log.info("Signal fired when student grade is calculated. Receiver: %s. Response: %s", receiver, response)
Beispiel #5
0
def grade(student, course, keep_raw_scores=False, course_structure=None):
    """
    Returns the grade of the student.

    Also sends a signal to update the minimum grade requirement status.
    """
    grade_summary = _grade(student, course, keep_raw_scores, course_structure)
    responses = GRADES_UPDATED.send_robust(
        sender=None,
        username=student.username,
        grade_summary=grade_summary,
        course_key=course.id,
        deadline=course.end
    )

    for receiver, response in responses:
        log.info('Signal fired when student grade is calculated. Receiver: %s. Response: %s', receiver, response)

    return grade_summary
def summary(student, course, keep_raw_scores=False, course_structure=None):
    """
    Returns the grade summary of the student for the given course.

    Also sends a signal to update the minimum grade requirement status.
    """
    grade_summary = _summary(student, course, keep_raw_scores, course_structure)
    responses = GRADES_UPDATED.send_robust(
        sender=None,
        username=student.username,
        grade_summary=grade_summary,
        course_key=course.id,
        deadline=course.end
    )

    for receiver, response in responses:
        log.info('Signal fired when student grade is calculated. Receiver: %s. Response: %s', receiver, response)

    return grade_summary
Beispiel #7
0
def grade(student, request, course, keep_raw_scores=False, field_data_cache=None, scores_client=None):
    """
    Wraps "_grade" with the manual_transaction context manager just in case
    there are unanticipated errors.
    Send a signal to update the minimum grade requirement status.
    """
    with manual_transaction():
        grade_summary = _grade(student, request, course, keep_raw_scores, field_data_cache, scores_client)
        responses = GRADES_UPDATED.send_robust(
            sender=None,
            username=request.user.username,
            grade_summary=grade_summary,
            course_key=course.id,
            deadline=course.end
        )

        for receiver, response in responses:
            log.info('Signal fired when student grade is calculated. Receiver: %s. Response: %s', receiver, response)

        return grade_summary