From ff8c14e88d9783301d116d757a14d81790b4e77a Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Tue, 8 Apr 2014 13:30:53 -0400 Subject: [PATCH] Only display active users for the certificate report Also removes the unnecessary pre-fetch. For certificate generations we will continue to generate certs for both active and inactive users. For the report we only display active users since it was confusing due to the instructor dashboard only displaying active users. --- .../certificates/management/commands/gen_cert_report.py | 4 ++-- .../certificates/management/commands/ungenerated_certs.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lms/djangoapps/certificates/management/commands/gen_cert_report.py b/lms/djangoapps/certificates/management/commands/gen_cert_report.py index 198ed048fd..505552de29 100644 --- a/lms/djangoapps/certificates/management/commands/gen_cert_report.py +++ b/lms/djangoapps/certificates/management/commands/gen_cert_report.py @@ -61,8 +61,8 @@ class Command(BaseCommand): # find students who are enrolled print "Looking up certificate states for {0}".format(course_id) enrolled_students = User.objects.filter( - courseenrollment__course_id=course_id).prefetch_related( - "groups").order_by('username') + courseenrollment__course_id=course_id, + courseenrollment__is_active=True) cert_data[course_id] = {'enrolled': enrolled_students.count()} tallies = GeneratedCertificate.objects.filter( diff --git a/lms/djangoapps/certificates/management/commands/ungenerated_certs.py b/lms/djangoapps/certificates/management/commands/ungenerated_certs.py index 5aa223acab..728a7d6489 100644 --- a/lms/djangoapps/certificates/management/commands/ungenerated_certs.py +++ b/lms/djangoapps/certificates/management/commands/ungenerated_certs.py @@ -84,8 +84,7 @@ class Command(BaseCommand): print "Fetching enrolled students for {0}".format(course_id) enrolled_students = User.objects.filter( - courseenrollment__course_id=course_id).prefetch_related( - "groups").order_by('username') + courseenrollment__course_id=course_id) xq = XQueueCertInterface() if options['insecure']: