Skip to content

feat: add exec ed course uuid to exec ed course cards cta button - #26

Open
jono-booth wants to merge 1 commit into
masterfrom
jb/exec-ed-course-uuid
Open

feat: add exec ed course uuid to exec ed course cards cta button#26
jono-booth wants to merge 1 commit into
masterfrom
jb/exec-ed-course-uuid

Conversation

@jono-booth

@jono-booth jono-booth commented Aug 14, 2026

Copy link
Copy Markdown

Summary

BeginCourseButton and ResumeButton now append a course_id query param (the course's catalog UUID) to the exec-ed tracking param, alongside the existing org_id:

const execEdTrackingParam = useMemo(() => {
  const isExecEd2UCourse = EXECUTIVE_EDUCATION_COURSE_MODES.includes(courseData.enrollment.mode);
  if (!isExecEd2UCourse) { return ''; }

  const { authOrgId } = learnerData.enterpriseDashboard || {};
  const { courseUuid } = courseData.courseRun;
  const courseIdParam = courseUuid ? `&course_id=${courseUuid}` : '';
  return `?org_id=${authOrgId}${courseIdParam}`;
}, [courseData.enrollment.mode, courseData.courseRun, learnerData.enterpriseDashboard]);

courseUuid comes from courseData.courseRun.courseUuid, which the backend now includes on the courseRun payload for Executive Education enrollments only (null/absent otherwise) — no frontend data-layer changes were needed since courseRun fields pass through useCourseData unfiltered.

This is step 2 of a 3-repo change for ENT-9254 — see "Related ticket" below for the full picture. Titan can use course_id to identify the presentation and redirect the learner straight into the OLC (Online Learning Campus) instead of stopping on the Titan profile page.

Related ticket / issue

  • Ticket: ENT-9254 — EdX-ExecEd Dashboard redirect to OLC without stopping in Titan

Companion changes (separate PRs/repos):

  1. edx-platform: adds courseUuid to the Learner Home courseRun API payload for Executive Education enrollments — edx/edx-platform#428
  2. Titan: reads course_id off the incoming request and redirects straight to the OLC when it matches a course, instead of rendering the profile page

This PR is safe to merge independently of the Titan change — it only adds an extra query param to a link Titan already receives (and already reads org_id off of); Titan simply ignores course_id until its side lands.

Reviewer guidance

Key files:

  • src/containers/CourseCard/components/CourseCardActions/BeginCourseButton.jsx
  • src/containers/CourseCard/components/CourseCardActions/ResumeButton.jsx

Same change duplicated in both files, matching the existing pattern (this logic isn't shared via a hook post the React Query refactor, and this PR isn't the place to introduce that dedup).

To test locally: enroll a test user in a course with an Executive Education mode, load the learner dashboard, and inspect the "Begin/Resume Course" link's href — it should include both org_id and course_id. For a non-ExecEd course, the link should have neither param.

Test coverage: BeginCourseButton.test.jsx / ResumeButton.test.jsx updated to assert course_id is included when courseUuid is present, and omitted (falls back to org_id only) when it isn't.

Screenshots

N/A — no UI change, only the destination URL of an existing CTA.

Checklist

  • PR title is meaningful and describes the change clearly
  • Summary of what changed
  • Link to the related ticket or issue
  • Link to related documentation and/or decision records when applicable
  • Provided local setup and testing instructions
  • Screenshots for UI changes, if applicable (N/A)

Copilot AI lite review requested due to automatic review settings August 14, 2026 09:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the executive-education Course Card CTA tracking URLs to optionally include the Exec Ed course UUID as a course_id query parameter, and expands the related unit tests to validate the new behavior.

Changes:

  • Append course_id=<courseUuid> (when available) to Exec Ed CTA URLs for Begin Course and Resume.
  • Add/adjust unit tests to cover presence/absence of courseUuid for both CTAs.
  • Refactor the Exec Ed tracking-param builder to always return '' for non–Exec Ed courses.

Reviewed changes

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

File Description
src/containers/CourseCard/components/CourseCardActions/ResumeButton.jsx Adds optional course_id query param for Exec Ed Resume CTA tracking URL.
src/containers/CourseCard/components/CourseCardActions/ResumeButton.test.jsx Updates Resume CTA tests to cover courseUuid present/absent scenarios.
src/containers/CourseCard/components/CourseCardActions/BeginCourseButton.jsx Adds optional course_id query param for Exec Ed Begin Course CTA tracking URL.
src/containers/CourseCard/components/CourseCardActions/BeginCourseButton.test.jsx Updates Begin Course CTA tests and adds coverage for courseUuid present/absent scenarios.
Suppressed comments (3)

src/containers/CourseCard/components/CourseCardActions/BeginCourseButton.test.jsx:16

  • These tests now click the rendered button, but useCourseTrackingEvent is mocked to return an object (not a function). That will be passed as onClick to the Paragon Button and will throw at runtime when clicked. Mock useCourseTrackingEvent to return a function instead.
    courseRun: { homeUrl: 'home-url', courseUuid: 'test-course-uuid' },
  }),
  useCourseTrackingEvent: jest.fn().mockReturnValue({
    trackCourseEvent: jest.fn(),
  }),

src/containers/CourseCard/components/CourseCardActions/ResumeButton.test.jsx:99

  • This test currently clicks the button, but useCourseTrackingEvent is mocked to return a non-function, so clicking will throw. Since the assertion is about useCourseTrackingEvent being called during render, remove the click/user-event setup and just render before asserting.
        render(<IntlProvider locale="en"><ResumeButton {...props} /></IntlProvider>);
        const user = userEvent.setup();
        const button = screen.getByRole('button', { name: 'Resume' });
        user.click(button);

src/containers/CourseCard/components/CourseCardActions/BeginCourseButton.test.jsx:97

  • Same as the previous test: user.click(...) should be awaited to avoid act warnings/flakiness. Make this test async and await user.click(button).
        const user = userEvent.setup();
        const button = screen.getByRole('button', { name: 'Begin Course' });
        user.click(button);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/containers/CourseCard/components/CourseCardActions/ResumeButton.jsx Outdated
Comment thread src/containers/CourseCard/components/CourseCardActions/BeginCourseButton.jsx Outdated
Comment thread src/containers/CourseCard/components/CourseCardActions/BeginCourseButton.test.jsx Outdated
Comment thread src/containers/CourseCard/components/CourseCardActions/ResumeButton.test.jsx Outdated
@jono-booth
jono-booth force-pushed the jb/exec-ed-course-uuid branch from 9824c52 to d229f17 Compare August 14, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants