Commit d4e6ad5f authored by Laury Bueno's avatar Laury Bueno
Browse files

[Certificate] Minor improvements on the certificate generation script

parent c930185c
...@@ -47,8 +47,8 @@ class Command(BaseCommand): ...@@ -47,8 +47,8 @@ class Command(BaseCommand):
created_cc += 1 created_cc += 1
# If '--certificate' was passed, transform any earned receipt in a certificate # If '--certificate' was passed, transform any earned receipt in a certificate
certificates_earned = 0
if options['certificate']: if options['certificate']:
certificates_earned = 0
for cc in CourseCertification.objects.all(): for cc in CourseCertification.objects.all():
if cc.course_student.can_emmit_receipt() and cc.type == CourseCertification.TYPES[0][0]: if cc.course_student.can_emmit_receipt() and cc.type == CourseCertification.TYPES[0][0]:
cc.type = CourseCertification.TYPES[1][0] cc.type = CourseCertification.TYPES[1][0]
...@@ -56,6 +56,9 @@ class Command(BaseCommand): ...@@ -56,6 +56,9 @@ class Command(BaseCommand):
cc.save() cc.save()
certificates_earned += 1 certificates_earned += 1
if options['dry_run']:
print('This is a dry run, so the below changes will not be commited')
print(f'CourseCertification objects created: {created_cc}') print(f'CourseCertification objects created: {created_cc}')
if options['certificate']: if options['certificate']:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment