diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index a2c30fd5d5..031a8b75b5 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -203,18 +203,6 @@ REQUESTING_CERT_DATA = CertData( certificate_available_date=None ) -UNVERIFIED_CERT_DATA = CertData( - CertificateStatuses.unverified, - _('Certificate unavailable'), - _( - 'You have not received a certificate because you do not have a current {platform_name} ' - 'verified identity.' - ).format(platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)), - download_url=None, - cert_web_view_url=None, - certificate_available_date=None -) - def _earned_but_not_available_cert_data(cert_downloadable_status): return CertData( @@ -238,6 +226,23 @@ def _downloadable_cert_data(download_url=None, cert_web_view_url=None): ) +def _unverified_cert_data(): + """ + platform_name is dynamically updated in multi-tenant installations + """ + return CertData( + CertificateStatuses.unverified, + _('Certificate unavailable'), + _( + 'You have not received a certificate because you do not have a current {platform_name} ' + 'verified identity.' + ).format(platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)), + download_url=None, + cert_web_view_url=None, + certificate_available_date=None + ) + + def user_groups(user): """ TODO (vshnayder): This is not used. When we have a new plan for groups, adjust appropriately. @@ -1196,15 +1201,12 @@ def _certificate_message(student, course, enrollment_mode): # lint-amnesty, pyl if cert_downloadable_status['is_generating']: return GENERATING_CERT_DATA - if cert_downloadable_status['is_unverified']: - return UNVERIFIED_CERT_DATA + if cert_downloadable_status['is_unverified'] or _missing_required_verification(student, enrollment_mode): + return _unverified_cert_data() if cert_downloadable_status['is_downloadable']: return _downloadable_certificate_message(course, cert_downloadable_status) - if _missing_required_verification(student, enrollment_mode): - return UNVERIFIED_CERT_DATA - return REQUESTING_CERT_DATA