fix: ignore grade for allowlist certs (#577)

Allowlist certs were hidden on the progress view because the grade
wasn't passing. This gives "downloadable" certs preference over the
grade.
This commit is contained in:
Matt Tuchfarber
2021-08-05 16:07:54 -04:00
committed by GitHub
parent d4a4cd24ec
commit 3b4dcfefaf

View File

@@ -83,17 +83,21 @@ function CertificateStatus({ intl }) {
const idVerificationSupportLink = <IdVerificationSupportLink />;
const profileLink = <ProfileLink />;
// Some learners have a valid ("downloadable") certificate without being in a passing
// state (e.g. learners who have been added to a course's allowlist), so we need to
// skip grade validation for these learners
const certIsDownloadable = certStatus === 'downloadable';
if (mode === COURSE_EXIT_MODES.disabled) {
certEventName = 'certificate_status_disabled';
} else if (mode === COURSE_EXIT_MODES.nonPassing) {
} else if (mode === COURSE_EXIT_MODES.nonPassing && !certIsDownloadable) {
certCase = 'notPassing';
certEventName = 'not_passing';
body = intl.formatMessage(messages[`${certCase}Body`]);
} else if (mode === COURSE_EXIT_MODES.inProgress) {
} else if (mode === COURSE_EXIT_MODES.inProgress && !certIsDownloadable) {
certCase = 'inProgress';
certEventName = 'has_scheduled_content';
body = intl.formatMessage(messages[`${certCase}Body`]);
} else if (mode === COURSE_EXIT_MODES.celebration) {
} else if (mode === COURSE_EXIT_MODES.celebration || certIsDownloadable) {
switch (certStatus) {
case 'requesting':
certCase = 'requestable';