Skip to content

fix: Update Walmart SPOC certificate to display the correct program name#3065

Open
ahtesham-quraish wants to merge 3 commits intomainfrom
ahtesham/certificate-branch-walmart
Open

fix: Update Walmart SPOC certificate to display the correct program name#3065
ahtesham-quraish wants to merge 3 commits intomainfrom
ahtesham/certificate-branch-walmart

Conversation

@ahtesham-quraish
Copy link
Contributor

@ahtesham-quraish ahtesham-quraish commented Mar 18, 2026

What are the relevant tickets?

https://github.com/mitodl/hq/issues/10565

Description (What does it do?)

For Walmart SPOC certificates - we are using the same template as the UAI programs which leads to an incorrectly generated certificate. We will need to replace "Universal Artificial Intelligence Module" with MIT CTL Supply Chain Education Program. Please note that this is for this SPOC only and should not affect the certificates for the true UAI programs.

We have applied the condition on this part SCx_WM from the course readable_id course-v1:MITxT+CTL.SCx_WM+1T2026

Screenshots (if appropriate):

image image

How can this be tested?

Additional Context

Copilot AI review requested due to automatic review settings March 18, 2026 09:00
@ahtesham-quraish ahtesham-quraish force-pushed the ahtesham/certificate-branch-walmart branch from f569dfe to b33ae5d Compare March 18, 2026 09:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates certificate rendering logic so the Walmart SPOC course certificates display “MIT CTL Supply Chain Education Program” instead of the UAI program name, while keeping existing UAI certificate behavior intact.

Changes:

  • Added a shared getCourseSpocInfo helper to detect the Walmart SPOC course (via readable_id) and derive program/certificate display strings.
  • Updated both the PDF certificate route and the HTML certificate page to use the derived program name and adjust badge positioning for SPOC certificates.
  • Added frontend test coverage for the Walmart SPOC certificate text, and updated the MitxOnline test factory to include readable_id.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontends/main/src/common/certificateUtils.ts Adds centralized SPOC detection + derived certificate display fields
frontends/main/src/app/certificate/[certificateType]/[uuid]/pdf/route.tsx Uses SPOC info to render correct program name and tweak badge layout in PDF
frontends/main/src/app/certificate/[certificateType]/[uuid]/page.tsx Updates metadata generation to use the derived program name/display type
frontends/main/src/app-pages/CertificatePage/CertificatePage.tsx Updates on-page certificate template to render the derived program name and adjust badge layout
frontends/main/src/app-pages/CertificatePage/CertificatePage.test.tsx Adds regression test ensuring Walmart SPOC shows MIT CTL program name
frontends/api/src/test-utils/factories/mitxonline.ts Adds readable_id to course certificate factory for SPOC detection/testing

You can also share your feedback on Copilot code review. Take the survey.

@ahtesham-quraish ahtesham-quraish added the Needs Review An open Pull Request that is ready for review label Mar 18, 2026
@pdpinch
Copy link
Member

pdpinch commented Mar 18, 2026

Sorry, I wasn't clear in my description. We're looking for a single template solution that will work for all cases.

  1. Remove the type of certificate from the badge area. There is no longer a desire to differentiate between "module," "course" and "program" certificates (at least, not in this template).

  2. The basic text of the certificate should be

This is to certify that
{full name}
has successfully completed all the requirements of
{course/program name}

  1. (could be a separate PR) Instead of start and end dates, the certificate should have just one date, the issue date.

Comment on lines 527 to 533
<Typography variant="h4">This is to certify that</Typography>
<NameText variant="h1">{userName}</NameText>
<AchievementText>
has successfully completed all requirements of the <PrintBreak />
<strong>Universal Artificial Intelligence</strong>{" "}
{shortDisplayType}:
has successfully completed all requirements of <PrintBreak />
</AchievementText>
</Certification>
<CourseInfo>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The "Universal Artificial Intelligence" branding is incorrectly removed from all certificates, instead of being conditionally removed only for the specified SPOC, due to missing conditional logic.
Severity: HIGH

Suggested Fix

Implement the conditional logic to check if the certificate's readable_id corresponds to the Walmart SPOC (e.g., contains SCx_WM). Use this condition to pass an isSpoc prop to the certificate components. Then, use the isSpoc prop within the components to conditionally render the certificate's title and description, ensuring the "Universal Artificial Intelligence" text is only removed for the specific SPOC.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: frontends/main/src/app-pages/CertificatePage/CertificatePage.tsx#L527-L533

Potential issue: The implementation removes the "Universal Artificial Intelligence"
branding from all certificates, not just for the intended Walmart SPOC. The pull request
was meant to apply this change conditionally based on the course `readable_id`
containing `SCx_WM`, but the conditional logic was never implemented. Instead, the text
was removed globally in both the React component (`CertificatePage.tsx`) and the PDF
generation route (`pdf/route.tsx`). This is evidenced by the addition of an unused
`isSpoc` prop, which appears to be incomplete scaffolding for the intended feature. This
change contradicts the explicit requirement that it should only affect the specific SPOC
and not other UAI programs.

Did we get this right? 👍 / 👎 to inform future reviews.

@ahtesham-quraish ahtesham-quraish force-pushed the ahtesham/certificate-branch-walmart branch from f0451de to c632f79 Compare March 19, 2026 08:17
@ahtesham-quraish
Copy link
Contributor Author

Sorry, I wasn't clear in my description. We're looking for a single template solution that will work for all cases.

  1. Remove the type of certificate from the badge area. There is no longer a desire to differentiate between "module," "course" and "program" certificates (at least, not in this template).
  2. The basic text of the certificate should be

This is to certify that
{full name}
has successfully completed all the requirements of
{course/program name}

  1. (could be a separate PR) Instead of start and end dates, the certificate should have just one date, the issue date.

I have incorporated the 1 and 2 point you can see the screenshot please.

@ahtesham-quraish ahtesham-quraish force-pushed the ahtesham/certificate-branch-walmart branch from c632f79 to 094c0b5 Compare March 19, 2026 13:03
@ahtesham-quraish ahtesham-quraish force-pushed the ahtesham/certificate-branch-walmart branch from 094c0b5 to 6063e1b Compare March 19, 2026 15:01
@ahtesham-quraish ahtesham-quraish force-pushed the ahtesham/certificate-branch-walmart branch 2 times, most recently from 860c316 to aa630f2 Compare March 19, 2026 16:27
@ahtesham-quraish ahtesham-quraish force-pushed the ahtesham/certificate-branch-walmart branch from aa630f2 to 5ee2c18 Compare March 19, 2026 16:29
Comment on lines +1 to +8
/**
* Returns common display info for a certificate.
*/
export const getCertificateInfo = (): { displayType: string } => {
return {
displayType: "Certificate",
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The getCertificateInfo() function is hardcoded to always return "Certificate", causing all certificate types to display this generic label instead of their specific program or course names.
Severity: HIGH

Suggested Fix

The getCertificateInfo() function should be modified to accept the certificate data object as a parameter. Inside the function, extract the readable_id and implement conditional logic to check if it corresponds to the SCx_WM course. Based on this check and the certificate type, return the appropriate display name, restoring the original dynamic behavior for all other certificates while applying the specific branding for the intended course.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: frontends/main/src/common/certificateUtils.ts#L1-L8

Potential issue: The new `getCertificateInfo()` function is implemented to always return
a hardcoded value of `{ displayType: "Certificate" }` and accepts no parameters. This
causes a global regression where all certificate types (e.g., "MicroMasters
Certificate", "XSeries Certificate") are now incorrectly displayed as just
"Certificate". The intended logic to conditionally change the display name for a
specific course (`SCx_WM`) was not implemented. Instead, the dynamic naming for all
other certificates was removed, affecting page titles, badge text, and metadata across
the entire platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants