Example #1
0
    def send_notifications(self, certs, grades, delay=0, page_size=0):
        """ Run actual handler commands for the provided certs and grades. """

        # First, do certs
        for i, cert in paged_query(certs, delay, page_size):
            log.info(
                "Handling credential changes %d for certificate %s",
                i, certstr(cert),
            )

            signal_args = {
                'sender': None,
                'user': cert.user,
                'course_key': cert.course_id,
                'mode': cert.mode,
                'status': cert.status,
            }
            handle_course_cert_changed(**signal_args)
            handle_cert_change(**signal_args)

        # Then do grades
        for i, grade in paged_query(grades, delay, page_size):
            log.info(
                "Handling grade changes %d for grade %s",
                i, gradestr(grade),
            )

            user = User.objects.get(id=grade.user_id)
            send_grade_if_interesting(user, grade.course_id, None, None, grade.letter_grade, grade.percent_grade)
    def send_notifications(self, certs, grades, delay=0, page_size=0):
        """ Run actual handler commands for the provided certs and grades. """

        # First, do certs
        for i, cert in paged_query(certs, delay, page_size):
            log.info(
                "Handling credential changes %d for certificate %s",
                i,
                certstr(cert),
            )

            signal_args = {
                'sender': None,
                'user': cert.user,
                'course_key': cert.course_id,
                'mode': cert.mode,
                'status': cert.status,
            }
            handle_course_cert_changed(**signal_args)
            handle_cert_change(**signal_args)

        # Then do grades
        for i, grade in paged_query(grades, delay, page_size):
            log.info(
                "Handling grade changes %d for grade %s",
                i,
                gradestr(grade),
            )

            user = User.objects.get(id=grade.user_id)
            send_grade_if_interesting(user, grade.course_id, None, None,
                                      grade.letter_grade, grade.percent_grade)