Skip to content
Snippets Groups Projects
Unverified Commit e5872cf8 authored by Christie Rice's avatar Christie Rice Committed by GitHub
Browse files

MICROBA-1032 Add allowlist check and move tests (#26785)

parent 0846e04f
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ import logging ...@@ -7,6 +7,7 @@ import logging
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from lms.djangoapps.certificates.api import is_using_certificate_allowlist_and_is_on_allowlist
from lms.djangoapps.certificates.models import GeneratedCertificate from lms.djangoapps.certificates.models import GeneratedCertificate
from lms.djangoapps.courseware import courses from lms.djangoapps.courseware import courses
from lms.djangoapps.grades.api import CourseGradeFactory from lms.djangoapps.grades.api import CourseGradeFactory
...@@ -16,7 +17,8 @@ log = logging.getLogger(__name__) ...@@ -16,7 +17,8 @@ log = logging.getLogger(__name__)
class Command(BaseCommand): class Command(BaseCommand):
""" """
Management command to find and grade all students that need to be graded. Management command to find and grade all students that need to be graded, unless the user is on the allowlist
for that course run.
""" """
help = """ help = """
...@@ -50,9 +52,13 @@ class Command(BaseCommand): ...@@ -50,9 +52,13 @@ class Command(BaseCommand):
).filter(grade__exact='') ).filter(grade__exact='')
course = courses.get_course_by_id(course_id) course = courses.get_course_by_id(course_id)
for cert in ungraded: for cert in ungraded:
# grade the student if is_using_certificate_allowlist_and_is_on_allowlist(cert.user, course_id):
grade = CourseGradeFactory().read(cert.user, course) log.info(f'{course_id} is using allowlist certificates, and the user {cert.user.id} is on its '
log.info('grading %s - %s', cert.user, grade.percent) f'allowlist. Certificate will not be regraded')
cert.grade = grade.percent else:
if not options['noop']: # grade the student
cert.save() grade = CourseGradeFactory().read(cert.user, course)
log.info('grading %s - %s', cert.user, grade.percent)
cert.grade = grade.percent
if not options['noop']:
cert.save()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment