Commit d9ab150e authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Automate certification for users

parent 889219b6
......@@ -101,6 +101,15 @@ class CourseCertificationViewSet(viewsets.ModelViewSet):
if not self.request.GET.get('user', False):
queryset = queryset.filter(course_student__user=self.request.user)
cert = queryset.first()
cs = cert.course_student
# Change receipt into certificate
if cs.get_current_class().user_can_certificate and cs.course_finished or \
cs.get_current_class().user_can_certificate_even_without_progress:
cert.type = 'certificate'
cert.save()
return queryset
......@@ -221,7 +230,7 @@ class CourseCertificationDetailView(DetailView):
certificate.course_student.finish_date.day,
certificate.course_student.finish_date.month,
certificate.course_student.finish_date.year
)
) if certificate.course_student.finish_date else 'xx/xx/xxxx'
workspace = context['cert_template'].workspace
w_name = workspace.name if workspace else ''
......
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