Repository navigation
fix: stop the progress tab's certificate card reading the entrance exam status - #2249
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## frontend-base #2249 +/- ##
=================================================
- Coverage 96.78% 96.77% -0.01%
=================================================
Files 475 478 +3
Lines 7368 7382 +14
Branches 1723 1769 +46
=================================================
+ Hits 7131 7144 +13
Misses 223 223
- Partials 14 15 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f51d72e to
23cbb1e
Compare
23cbb1e to
bea109b
Compare
arbrandes
left a comment
There was a problem hiding this comment.
Pre-emptively approved, but Claude did flag one thing we should probably take a look at before merging. Comment inline.
|
|
||
| const entranceExamPassed = entranceExamData?.entranceExamPassed ?? null; | ||
| // GET /api/courseware/course/ answers for the requester, not the target user: https://github.com/openedx/frontend-app-learning/issues/2244 | ||
| const entranceExamPassed = targetUserId ? null : (entranceExamData?.entranceExamPassed ?? null); |
There was a problem hiding this comment.
I don't think we should hide the card based on this flag. Probably best to keep master's behavior for now: always pass null here, and don't fetch the courseware metadata on the progress tab at all.
The problem is that the LMS only sets entrance_exam_passed to true if the learner actually passed the exam (code). It stays false for learners an instructor allowed to skip the exam, and for course staff who are enrolled. Those people can take the whole course, but with this change they'd never see the cards that let them request a certificate, verify their ID, or upgrade.
We can't tell "failed the exam" from "was allowed to skip it" on the frontend, so I think this needs the backend change described in #2244 first.
There was a problem hiding this comment.
…am status On master the certificate status card reads the courseware metadata query with enabled: false for the learner's entrance exam result, and nothing on the progress tab fetches that query, so the card never has it (#2243). Under the shell a tab switch keeps the query cache, so once a courseware page fills it the card would hide for a learner whose entrance_exam_passed is false, on a tab switch and not on a page load. That field is also false for a learner allowed to skip the exam and for enrolled course staff, who can take the whole course: hiding would take their certificate, identity verification and upgrade cards away. The card no longer reads the status. Its call to getCourseExitMode keeps the argument as a commented-out line under the URL of #2243, and the tab fetches no courseware metadata, on a learner's own page or on progress/:targetUserId (#2244). The courseware metadata slice of courseware/data ports here: getCourseMetadata, coursewareMeta.ts, coursewareMetadataQuery with useCoursewareMetadata in place of its stub, and the courseMetadata factory. The rest of api.js, apiHooks.ts and the factories comes with #2195; useMinimalCourseOutline stays a stub until then. master's apiHooks.test.tsx has no case of its own for useCoursewareMetadata, so cases for the hook are added beside it. Part of #2190. Co-Authored-By: Claude <noreply@anthropic.com>
bea109b to
e22c204
Compare
Summary
The progress tab's certificate card no longer reads the learner's entrance exam status.
master's card reads it from the courseware metadata query without fetching, and nothing on the progress tab fetches that query, so onmasterthe card never has it (#2243). Under the shell a tab switch keeps the query cache, so once the courseware pages are ported the card would start hiding for a learner whoseentrance_exam_passedisfalse. That field is alsofalsefor a learner allowed to skip the exam and for enrolled course staff, so the card stops reading it. No change a learner can see: the card shows what it shows onmaster. The legacy tree undersrc/is untouched.Part of #1905. Resolves #2190. Stacked above #2247.
Note
For reviewers: this PR's first version did the opposite. It fetched the courseware metadata on the progress tab and hid the card from a learner who had not passed the exam. Review reversed it (decision log entry 1).
What changed
CertificateStatuscallsgetCourseExitModewithoutentranceExamPassed. ItsuseCoursewareMetadataread and itsentranceExamPassedline are removed, and the argument stays in the call as a commented-out line under Progress tab: the certificate card ignores the entrance exam #2243's URL. The parameter defaults tonull, and the function's one test of it is=== false.ProgressTab.jsxis as refactor: port the progress tab to frontend-base #2247 left it. The progress tab requests no courseware metadata, on a learner's own page or onprogress/:targetUserId(Progress tab: staff viewing a learner's progress cannot get that learner's entrance exam status #2244).courseware/data/ports here.coursewareMeta.tswhole,getCourseMetadatainapi.js,coursewareMetadataQueryanduseCoursewareMetadatainapiHooks.tsin place of the stub from refactor: port the modules the progress tab shares to frontend-base #2246, and thecourseMetadatafactory. Nothing fetches the query in this layer outside the tests. Port the courseware container and redirects to frontend-base #2195 adds the rest of each file at the same path;useMinimalCourseOutlinestays a stub until then.ProgressTab.test.jsxgains two "Entrance exam status" assertions, each on a learner's own page and onprogress/10: no courseware metadata request, and the card showing with a failed entrance exam in the query cache.ProgressTabComponents.test.tsxloses the case that gave the card a failed exam, and its mock of the courseware hooks.courseware/data/apiHooks.test.tsxis new, with cases for the hook. One comment in the lower layers' tests, false once the query is real, is corrected.Known differences from
mastermasterthat read is always empty, since every way into the progress tab is a page load. Here a tab switch keeps the cache, and the read would hide the card on that path alone once a courseware page fills it.Testing
At the layer's commit, in
frontend-base/: lint, the tests,buildandbuild:cipass. Lint ran with the package's.jsxfiles included (openedx/frontend-base#327).it.skipunder Wire up the frontend-base masquerade bar #2194, and the streak-celebration case under Port the celebrations to frontend-base #2201).CertificateStatus.jsx, which hasmaster's read, the two query-cache cases fail and the two request cases pass.Coverage. The package is at 100% of lines, against its 96.15% bar. Counted from the local coverage report the way Codecov counts a patch, this layer adds 17 lines with none missed or partly covered. One line outside the patch becomes partly covered:
CertificateStatus.jsxline 101,master's lastelse if(decision log entry 6).Manual testing. None for this version: nothing a learner can see changes, and the suite asserts both things the layer does (decision log entry 11).
Decisions
What was decided while building this layer; the scope is in #2190, the card's status in #2243 and the staff view in #2244.
Full decision log
Decisions: the entrance exam status on the progress tab (#2249)
Decisions made while building this layer of #2190. The scope is in #2190's plan, the
status on a learner's own page is #2243 and the staff view is #2244. The tab itself is
ported in #2247, the layer below.
The layer's first version, pushed 2026-11-12, made the certificate card apply the
status. Review reversed that (entry 1). The entries describe the layer as it is now and
say where the first version differed.
The certificate card does not apply the entrance exam status.
CertificateStatuscalls
getCourseExitModewithoutentranceExamPassed. The parameter defaults tonulland the function's one test of it is=== false, so the card renders as itwould for a course with no entrance exam, which is what every learner sees on
master.ProgressTabfetched the coursewaremetadata on a learner's own page and waited for it, and the card rendered nothing
for a learner whose
entrance_exam_passedwasfalse. The reason is arbrandes'sreview comment of 2026-11-13
(fix: stop the progress tab's certificate card reading the entrance exam status #2249 (comment));
Brian agreed on 2026-11-18.
entrance_exam_passedisfalsefor more learners than the exam holds back.user_has_passed_entrance_examreturns whether the exam's milestone is still outstanding. The exemptions are in
user_can_skip_entrance_exam, in the same file: course staff, and a learner aninstructor allowed to skip the exam (
EntranceExamConfiguration). The field doesnot consult it. This is read from edx-platform at that commit, not observed on a
course with an entrance exam.
see the cards for requesting a certificate, verifying their identity or upgrading.
entrance_exam_datainGET /api/courseware/course/has five fields (current score, enabled, id, minimumscore, passed) and none says the learner may skip.
is true of them (not passing, or upgrade), as on
master. Hiding takes the cardfrom a learner entitled to it.
What a learner sees: what
mastershows. The layer changes nothing a learnercan see.
code alone: it added the read, the
entranceExamPassedline and the extraargument to the card. fix: corrects the navigation issue if the student does not pass the entrance exam #1429 and the issue it closed, [Bug] Students have access to course content even if the Entrance Exam wasn't finished #1415, are about the unit
navigation's Next button; neither mentions the progress tab, and no test covered
the card's branch.
useModel('coursewareMeta', courseId)ona page that never loaded that model, and refactor!: read sections and coursewareMeta from the courseware queries, not useModel #2140 converted it to the query read with
the same result.
The card reads nothing from the query cache.
master's line, theenabled: falseread of the courseware metadata, is removed with its import and theentranceExamPassedline. It is not kept.masterthe read is always empty: nothing on the progress tab fetches thatquery and every way into the tab is a page load (Progress tab: the certificate card ignores the entrance exam #2243).
ported (Port the courseware container and redirects to frontend-base #2195),
CoursewareContainerfills that query, so a learner switchingfrom a courseware page to Progress would reach the card with the status cached,
and a page load would not. Keeping
master's line would bring back, on that pathonly, the hiding entry 1 rejects.
progress/:targetUserId, where the cache could hold therequester's own status (Progress tab: staff viewing a learner's progress cannot get that learner's entrance exam status #2244). The first version's two
targetUserIdconditionsare gone: no page reads the status, so none needs an exception.
The argument stays in the call as a commented-out line with Progress tab: the certificate card ignores the entrance exam #2243's URL:
// entranceExamPassed, // https://github.com/openedx/frontend-app-learning/issues/2243,the form
courseware/data/__factories__/index.jsuses for its unported imports.is Progress tab: the certificate card ignores the entrance exam #2243's to state.
nullwith a comment was drafted and dropped:nullis theparameter's default, so writing it reads as a chosen value, and four wordings of
the comment failed to explain a choice that was not one.
puts the status in the progress response, so a commented-out read of the
courseware metadata would point at the wrong source.
ProgressTab.jsxis the layer below's file again. It runs no coursewaremetadata query and waits for none. None of the first version's costs remain: no
extra request on the page, no error view when that request fails, no user activity
recorded for the requester.
The card's last
else ifstays asmasterwrote it.else if (mode === COURSE_EXIT_MODES.celebration || certIsDownloadable)had one wayto its false side:
entranceExamFailmode without a downloadable certificate. Thecard can no longer be in that mode, so the line is partly covered. It is not in the
patch. Turning it into a plain
elsewould changemaster's logic; Brian left it.getCourseExitModekeeps the mode, which the unit navigation uses.The courseware metadata slice of
courseware/data/stays in this layer. Itwas ported for the first version's fetch, and the rest of the module ports with
Port the courseware container and redirects to frontend-base #2195. Moving it up to refactor: port the courseware data module to frontend-base #2260 was the other candidate. It stays because it was
reviewed here, refactor: port the courseware data module to frontend-base #2260 adds the rest of each file at the same path with no change,
and the cache case of entry 8 needs the real query key. In this layer nothing
fetches the query outside the tests.
coursewareMeta.tsports whole.api.jsholdsgetCourseMetadataonly, andapiHooks.tsholdscoursewareMetadataQueryanduseCoursewareMetadata. Each filehas one manifest line; Port the courseware container and redirects to frontend-base #2195 adds the rest of each file at the same path.
useMinimalCourseOutlinestays the stub refactor: port the modules the progress tab shares to frontend-base #2246 added, under Port the courseware container and redirects to frontend-base #2195's URL.courseMetadatafactory ports, with a__factories__/index.jswhose otherfour imports are commented out under Port the courseware container and redirects to frontend-base #2195's URL.
useCoursewareMetadatabuilds its options withcoursewareMetadataQuery(courseId!)and is disabled without a course id, as the hooks in
course-home/data/apiHooks.tsdo.
Tests.
ProgressTab.test.jsx, "Entrance exam status": two assertions, each run on alearner's own page and on
progress/10. The tab makes no request to/api/courseware/course/. With a failed entrance exam seeded in the query cachebefore the card mounts, the certificate card renders. The suite's
beforeEachnolonger answers the courseware request.
CertificateStatus.jsx,which has
master's read, both fail and the two request cases pass (2026-11-18).ProgressTabComponents.test.tsxloses the case that gave the card a mockedentranceExamPassed: false, and with it the mock of@src/courseware/data/apiHooks, its import, itsbeforeEachand its comment:nothing the file renders reads that module now.
courseware/data/apiHooks.test.tsxis new: the query carries the query defaults,the hook fetches once, and it requests nothing when disabled or without a course
id.
masterhas a file at this path with cases for eleven other hooks and queriesand none of its own for
useCoursewareMetadata, which only does the fetching inits
useSequenceIdsanduseIsCourseLoadedcases; Port the courseware container and redirects to frontend-base #2195 ports those into thisfile.
getCourseMetadataand the normalizer get no cases of their own. The hook's fetchcase runs both, and in this layer it is the only thing that does.
corrected:
course-exit/utils.test.tssaid both courseware queries are stubs.npm run lintpasses with the package's.jsxfiles included (openedx lintdoes not lint.jsxfiles frontend-base#327), andbuildandbuild:cipass. The full run is entry 10.
One commit. The reversal is amended into the layer's commit, whose message is
rewritten since the first one described the fetch. The five layers above are
rebased onto it with their commits unchanged.
Coverage at this layer (2026-11-18). The full run: 36 suites,
410 tests passed and 7 skipped. 100% of lines for the package. Counted from the
local coverage report the way Codecov counts a patch, against the layer below, the
layer adds 17 lines with none missed or partly covered. The partly covered line of
entry 6,
CertificateStatus.jsxline 101, ismaster's and outside the patch. TheuseMinimalCourseOutlinestub's function is not called (Port the courseware container and redirects to frontend-base #2195).No manual pass for this version. The layer changes nothing a learner can see,
and the suite asserts the two things it does: no courseware metadata request, and
the card unmoved by what the query cache holds. The first version's pass
(2026-11-12) looked at the real request and at the card going away with the
response faked; both were of code this version removes.
🤖 Generated with Claude Code