diff --git a/lms/djangoapps/certificates/queue.py b/lms/djangoapps/certificates/queue.py index d84ad71b8c..744f73382a 100644 --- a/lms/djangoapps/certificates/queue.py +++ b/lms/djangoapps/certificates/queue.py @@ -114,12 +114,12 @@ class XQueueCertInterface: student - User.object course_id - courseenrollment.course_id (string) + [PDF Certificates only] WARNING: this command will leave the old certificate, if one exists, laying around in AWS taking up space. If this is a problem, take pains to clean up storage before running this command. - Change the certificate status to unavailable (if it exists) and request - grading. Passing grades will put a certificate request on the queue. + Invalidate the certificate (if it exists) and request a new certificate. Return the certificate. """ @@ -131,14 +131,8 @@ class XQueueCertInterface: certificate = GeneratedCertificate.eligible_certificates.get(user=student, course_id=course_id) LOGGER.info( - ( - "Found an existing certificate entry for student %s " - "in course '%s' " - "with status '%s' while regenerating certificates. " - ), - student.id, - str(course_id), - certificate.status + f"Found an existing certificate entry for student {student.id} in course '{course_id}' with status " + f"'{certificate.status}' while regenerating certificates." ) if certificate.download_url: @@ -147,19 +141,12 @@ class XQueueCertInterface: ) return None - certificate.status = status.unavailable - certificate.save() + certificate.invalidate() LOGGER.info( - ( - "The certificate status for student %s " - "in course '%s' has been changed to '%s'." - ), - student.id, - str(course_id), - certificate.status + f"The certificate status for student {student.id} in course '{course_id} has been changed to " + f"'{certificate.status}'." ) - except GeneratedCertificate.DoesNotExist: pass