Skip to content
Snippets Groups Projects
Commit fd15fcc4 authored by Zainab Amir's avatar Zainab Amir
Browse files

Optimize award_program_certificates task

More than 70% of the execution time is spent in CPU. The change of
query is to avoid the massive course_id__in the GeneratedCertificate
was doing on CourseOverview

PROD-67
parent 489c78df
No related merge requests found
......@@ -226,8 +226,9 @@ class EligibleAvailableCertificateManager(EligibleCertificateManager):
Return a queryset for `GeneratedCertificate` models, filtering out
ineligible certificates and any linked to nonexistent courses.
"""
return super(EligibleAvailableCertificateManager, self).get_queryset().filter(
course_id__in=list(CourseOverview.objects.values_list('id', flat=True))
return super(EligibleAvailableCertificateManager, self).get_queryset().extra(
tables=['course_overviews_courseoverview'],
where=['course_id = course_overviews_courseoverview.id']
)
......
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