Updated program credential back-population command to account for no-id-professional
This command has been updated to treat professional and no-id-professional enrollments in the same manner. ECOM-7442
This commit is contained in:
@@ -8,6 +8,7 @@ from django.db.models import Q
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from certificates.models import GeneratedCertificate, CertificateStatuses # pylint: disable=import-error
|
||||
from course_modes.models import CourseMode
|
||||
from openedx.core.djangoapps.catalog.utils import get_programs
|
||||
from openedx.core.djangoapps.programs.tasks.v1.tasks import award_program_certificates
|
||||
|
||||
@@ -100,6 +101,11 @@ class Command(BaseCommand):
|
||||
[Q(course_id=course_run.key, mode=course_run.type) for course_run in self.course_runs]
|
||||
)
|
||||
|
||||
# Account for the fact that no-id-professional and professional are equivalent
|
||||
for course_run in self.course_runs:
|
||||
if course_run.type == CourseMode.PROFESSIONAL:
|
||||
course_run_query |= Q(course_id=course_run.key, mode=CourseMode.NO_ID_PROFESSIONAL_MODE)
|
||||
|
||||
query = status_query & course_run_query
|
||||
|
||||
username_dicts = GeneratedCertificate.eligible_certificates.filter(query).values('user__username').distinct()
|
||||
|
||||
Reference in New Issue
Block a user