Release 0.65.5#3279
Conversation
* temporarily switch to development build of mitxonline-api-clients * add the language options dropdown to the b2b contract page Co-authored-by: Copilot <copilot@github.com> * add language picker functionality to B2C programs in the dashboard Co-authored-by: Copilot <copilot@github.com> * add language_options to the course factory * swap out static text on the b2b contract and b2c program pages based on language selection Co-authored-by: Copilot <copilot@github.com> * add tests to ensure language picker isn't shown when there is only one option * switch back to official API package * fix nextjs build errer Co-authored-by: Copilot <copilot@github.com> * fix typecheck error * wrap enrollment re-fetch in try catch Co-authored-by: Copilot <copilot@github.com> * add missing diacritics in static translations Co-authored-by: Copilot <copilot@github.com> * use SimpleSelectField for accessible label Co-authored-by: Copilot <copilot@github.com> * fix language select label display issue after moving to simpleselectfield with label prop and fix order mapping issue Co-authored-by: Copilot <copilot@github.com> * add error handling to enrollment re-fetch Co-authored-by: Copilot <copilot@github.com> * add error handling to enrollment refetch in just in time dialog Co-authored-by: Copilot <copilot@github.com> * fix flaky test pattern Co-authored-by: Copilot <copilot@github.com> * use copied array instead of in-place sort Co-authored-by: Copilot <copilot@github.com> * language picker should not be shown if there is only one option Co-authored-by: Copilot <copilot@github.com> * add a test to mke sure b2b contract runs are still enrollable when they should be * fix flaky test * flaky test fix attempt 2 Co-authored-by: Copilot <copilot@github.com> * strip out static translations Co-authored-by: Copilot <copilot@github.com> * move the language selection dropdown on b2b contract pages for the top and use it in every program on the page Co-authored-by: Copilot <copilot@github.com> * correct tests based on new b2b page language dropdown location * correct spelling for latin american spanish * auto-width for the dropdown Co-authored-by: Copilot <copilot@github.com> * get rid of url rewriting in dashboard card that was added as a debugging step originally Co-authored-by: Copilot <copilot@github.com> * simplify language run resolution Co-authored-by: Copilot <copilot@github.com> * fix unenrolled run selection for languages and add some hopefully reasonable comments Co-authored-by: Copilot <copilot@github.com> * fix brittle ordering tests Co-authored-by: Copilot <copilot@github.com> * update comment on getResolvedRunForSelectedLanguage to be more relevant * add a debug marker for synthetic course runs Co-authored-by: Copilot <copilot@github.com> --------- Co-authored-by: Copilot <copilot@github.com>
…#3253) * fix: wrap My Learning course/module titles in heading tags for screen reader accessibility * fix Prettier issue * test: assert h3 heading level in dashboard course/program title tests * fix: use h4 for module titles nested under ProgramAsCourseCard
#3276) * use the new courseware_url on language_options, filter language_options course runs by is_enrollable Co-authored-by: Copilot <copilot@github.com> * fix is_enrollable check, add back in synthetic run with courseware_url because it's still necessary Co-authored-by: Copilot <copilot@github.com> * fix test * move back to released mitxonline api client * fix ts error * fix typecheck * remove unnecessary refetching of enrollments from JIT dialog Co-authored-by: Copilot <copilot@github.com> * remove more unnecessary refetching of enrollments Co-authored-by: Copilot <copilot@github.com> --------- Co-authored-by: Copilot <copilot@github.com>
OpenAPI ChangesNo changes detected Unexpected changes? Ensure your branch is up-to-date with |
| const isContractPageResource = Boolean(b2bContractId) | ||
|
|
||
| const hasEnrollableRuns = isCourse | ||
| ? (resource.data.courseruns ?? []).some((run) => run.is_enrollable) | ||
| ? (courseRun?.is_enrollable ?? false) | ||
| : true | ||
|
|
||
| const disableEnrollment = isCourse && !hasEnrollableRuns |
There was a problem hiding this comment.
Bug: The enrollment button may be incorrectly disabled for courses with a contractId if no runs match that contract, even when other enrollable runs are available.
Severity: MEDIUM
Suggested Fix
The calculation for hasEnrollableRuns should be decoupled from the getBestRun logic when a contractId is present. Instead, it should check if any of the course's runs are enrollable, similar to the original implementation: (resource.data.courseruns ?? []).some((run) => run.is_enrollable). This ensures the button's visibility is not incorrectly tied to the contract-specific run selection.
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/DashboardPage/CoursewareDisplay/DashboardCard.tsx#L844-L850
Potential issue: The logic to determine if a course has enrollable runs has been
changed. Previously, it checked if any run within a course was enrollable. The new logic
uses `getBestRun` with `enrollableOnly: true` and a `contractId`. If a `contractId` is
provided but there are no enrollable runs matching that specific contract, `getBestRun`
returns `undefined`. This causes the `hasEnrollableRuns` flag to become `false`,
disabling the enrollment button, even if other enrollable runs (not matching the
contract) exist for the course. This is a regression from the previous behavior.
Did we get this right? 👍 / 👎 to inform future reviews.
Carey P Gumaer
Danielle Frappier