diff --git a/lms/djangoapps/certificates/management/commands/gen_cert_report.py b/lms/djangoapps/certificates/management/commands/gen_cert_report.py index 21e1775665c342f8891324e00e0e40a8721c956b..93ee20b19f83066a0232367eaed855aa39f1747d 100644 --- a/lms/djangoapps/certificates/management/commands/gen_cert_report.py +++ b/lms/djangoapps/certificates/management/commands/gen_cert_report.py @@ -70,8 +70,9 @@ class Command(BaseCommand): cert_data[course_id] = {'enrolled': enrolled_students.count()} cert_data[course_id].update({'unavailable': unavailable_count}) - tallies = GeneratedCertificate.objects.values( - 'status').annotate(dcount=Count('status')) + tallies = GeneratedCertificate.objects.filter( + course_id__exact=course_id).values('status').annotate( + dcount=Count('status')) cert_data[course_id].update( {status['status']: status['dcount'] for status in tallies})