Repository navigation
Description
User Story
As a learner, I want to know what my recommended next action is in my CBE course in order to maintain momentum in learning and skill demonstration without having to figure this out myself or have someone tell me.
Description
This ticket implements the Recommended Next Action notice inside the right hand CBE progress panel from #743, which #829 registers in the ProgressTabCertificateStatusSidePanelSlot.
This implementation will call the endpoint built in #754. If the reason listed in that endpoint's response is:
continue_available, then the first word in the sentence should be "Continue", and the button should say "Continue assignment"retry_available, then the first word should be "Retake", and the button should say "Retake assignment"not_started, then the first word should be "Take", and the button should say "Take assignment"- Anything else, then show a "Resume course" button instead of the sentence, using the
resume_urlthat [BE] GET Recommended Next Action for CBE Learner in Course #754 returns.
Next in the sentence should be the name of the subsection, in bold. The button below the sentence opens the subsection (the url that #754 returns).
Then the sentence should say "and score ", where the threshold reads the same way as the rule lines on the competency cards: "80% or better", "40% or lower", or "exactly 100%". If the subsection's criteria have different thresholds that can't be combined into one, this part is left out.
The sentence ends with "to demonstrate ", listing each competency in the response's criteria once (for example "Writing Poetry and Analysis").
Therefore, the sentence displayed in the "Recommended Next Action" notice will say: "Continue/Take/Retake and score to demonstrate ."
Context
- Corresponding architecture spike: [ARCH] Document how we will calculate what the recommended next action is and investigate what it will take to implement these calculations. Also document what data about the recommended next action should be returned and displayed. #757
- Frontend counterpart to [BE] GET Recommended Next Action for CBE Learner in Course #754
- Blocked by [FE] Right Side Course Competency Progress #743
UX Design
- Figma Design
- Screenshots:
Acceptance Criteria
These scenarios use the following terms:
- The notice is the "Recommended Next Action" notice in the right-hand CBE progress panel from [FE] Right Side Course Competency Progress #743. Its card styling, heading icon, and button follow the UX design.
- The recommendation is what [BE] GET Recommended Next Action for CBE Learner in Course #754 returns for the learner whose progress is shown. It names a subsection to continue, take, or retake, and the competencies on that subsection the learner still has to demonstrate, each with the score its criterion requires.
- A recommendation to continue is for a subsection the learner has started but hasn't finished their own part of. A recommendation to retake is for a subsection the learner has been scored on, or had reset by staff, without demonstrating its competency, and can submit to again. A recommendation to take is for a subsection the learner hasn't started.
- Subsection and competency names appear as they are stored in the course and aren't translated.
Scenario Outline: The recommendation reads as one sentence that starts with Continue, Take, or Retake, followed by a matching button
Given the learner's recommendation is to <action> "Poetry Assignment 1", to demonstrate "Writing Poetry", whose criterion on it requires 80% or better
When the learner opens the course's Progress tab
Then the notice appears in the right-hand CBE progress panel, headed "Recommended Next Action"
And the notice reads "<verb> Poetry Assignment 1 and score 80% or better to demonstrate Writing Poetry."
And below the sentence is a button labeled "<button>"
Examples:
| action | verb | button |
| continue | Continue | Continue assignment |
| retake | Retake | Retake assignment |
| take | Take | Take assignment |
Scenario: The button opens the recommended subsection
Given the learner's recommendation is to retake "Poetry Assignment 1"
When the learner selects the notice's "Retake assignment" button
Then "Poetry Assignment 1" opens in the courseware, in the same browser tab
Scenario Outline: The score uses the same thresholds as the competency cards' rule lines
Given the learner's recommendation is to take "Quiz 3", to demonstrate "Analysis", whose criterion on it requires a score <comparison> <threshold>%
When the learner opens the course's Progress tab
Then the notice reads "Take Quiz 3 and score <score> to demonstrate Analysis."
Examples:
| comparison | threshold | score |
| at or above | 82 | 82% or better |
| at or above | 29 | 29% or better |
| at or above | 82.5 | 82.5% or better |
| at or below | 40 | 40% or lower |
| exactly equal to | 100 | exactly 100% |
Scenario Outline: Criteria that compare the same way show the one score that satisfies all of them
Given the learner's recommendation is to retake "Final Project", to demonstrate "Writing Poetry" and "Analysis"
And the criterion for "Writing Poetry" requires <first> and the criterion for "Analysis" requires <second>
When the learner opens the course's Progress tab
Then the notice reads "Retake Final Project and score <score> to demonstrate Writing Poetry and Analysis."
Examples:
| first | second | score |
| 75% or better | 80% or better | 80% or better |
| 40% or lower | 30% or lower | 30% or lower |
| exactly 100% | exactly 100% | exactly 100% |
Scenario Outline: The score is left out when the criteria compare in different ways or require different exact scores
Given the learner's recommendation is to retake "Final Project", to demonstrate "Writing Poetry" and "Analysis"
And the criterion for "Writing Poetry" requires <first> and the criterion for "Analysis" requires <second>
When the learner opens the course's Progress tab
Then the notice reads "Retake Final Project to demonstrate Writing Poetry and Analysis."
Examples:
| first | second |
| 80% or better | 40% or lower |
| exactly 100% | 80% or better |
| exactly 90% | exactly 100% |
Scenario: The score is left out when a criterion's rule isn't recognized
Given the learner's recommendation is to take "Lab 2", to demonstrate "Analysis" and "Lab Safety"
And the criterion for "Analysis" requires 80% or better, and the criterion for "Lab Safety" uses a rule the plugin doesn't recognize
When the learner opens the course's Progress tab
Then the notice reads "Take Lab 2 to demonstrate Analysis and Lab Safety."
And the unrecognized rule is reported to the site's logging service
Scenario Outline: Every competency the subsection counts toward is named, as a list, in the order the server returns them
Given the learner's recommendation is to retake "Poetry Assignment 1", to demonstrate <competencies>, in that order, each requiring 80% or better
When the learner opens the course's Progress tab
Then the notice reads "Retake Poetry Assignment 1 and score 80% or better to demonstrate <list>."
Examples:
| competencies | list |
| "Writing Poetry" and "Analysis" | Writing Poetry and Analysis |
| "Writing Poetry", "Analysis", and "Critique" | Writing Poetry, Analysis, and Critique |
Scenario Outline: A competency name that appears in more than one criterion on the subsection is named once, and its score shows only when every one of those criteria requires the same score
Given the learner's recommendation is to retake "Poetry Assignment 1"
And the subsection has <criteria>
When the learner opens the course's Progress tab
Then the notice reads "<sentence>"
Examples:
| criteria | sentence |
| two criteria for "Writing Poetry", both requiring 80% or better | Retake Poetry Assignment 1 and score 80% or better to demonstrate Writing Poetry. |
| two criteria for "Writing Poetry", one requiring 75% or better and one requiring 80% or better | Retake Poetry Assignment 1 to demonstrate Writing Poetry. |
| criteria for two different competencies that are both named "Writing Poetry", both requiring 80% or better | Retake Poetry Assignment 1 and score 80% or better to demonstrate Writing Poetry. |
| criteria for two different competencies that are both named "Writing Poetry", one requiring 75% or better and one 80% | Retake Poetry Assignment 1 to demonstrate Writing Poetry. |
Scenario Outline: A button to resume the course appears when there is no recommendation
Given a course with competency criteria
And the learner has no recommendation, because <situation>
When the learner opens the course's Progress tab
Then the notice shows a "Resume course" button in place of a recommendation sentence
And selecting the button opens the course where the learner left off, the same place the course home's "Resume course" button opens
Examples:
| situation |
| the learner has demonstrated every competency this course's criteria count toward |
| no subsection the learner still has a competency to demonstrate on can be opened now, for example because none is released yet |
| each subsection the learner still has a competency to demonstrate on is awaiting grading or has no attempts left |
| each subsection the learner still has a competency to demonstrate on is past the learner's due date |
| the only subsection the learner could retake is one whose result is hidden from the learner |
Scenario: Nothing from the notice appears while the recommendation is loading
Given a course with competency criteria
And the learner's recommendation is still loading
When the learner opens the course's Progress tab
Then no notice, heading, loading indicator, or placeholder from the notice appears
And the rest of the right-hand CBE progress panel and the Progress tab appear without waiting for the recommendation
Scenario: The notice stays hidden when the recommendation can't be loaded
Given the request for the learner's recommendation fails, for example because the site hasn't deployed #754's endpoint, the server returns an error, or the request is refused
When the learner opens the course's Progress tab
Then nothing from the notice appears, and no error message is shown to the learner
And the failure is reported to the site's logging service
And the rest of the right-hand CBE progress panel appears as usual
Scenario: A failure while displaying the notice doesn't hide the rest of the panel
Given the learner's recommendation loads, but displaying the notice fails, for example because the recommendation is malformed
When the learner opens the course's Progress tab
Then nothing from the notice appears
And the rest of the right-hand CBE progress panel appears as usual
And the failure is reported to the site's logging service
Scenario: Course staff viewing a learner's progress see that learner's recommendation
Given learner A's recommendation is to retake "Poetry Assignment 1", to demonstrate "Writing Poetry", whose criterion on it requires 80% or better
When a member of course staff opens learner A's progress page, for example from the instructor dashboard
Then the notice reads "Retake Poetry Assignment 1 and score 80% or better to demonstrate Writing Poetry."
Scenario: Course staff moving between learners see each learner's own recommendation
Given learner A's recommendation is to retake "Poetry Assignment 1", and learner B's is to take "Quiz 2", to demonstrate "Analysis", whose criterion on it requires 70% or better
And a member of course staff has opened learner A's progress page
When the staff member opens learner B's progress page in the same browser session
Then the notice reads "Take Quiz 2 and score 70% or better to demonstrate Analysis."
And "Poetry Assignment 1" doesn't appear in the notice
Scenario: Course staff viewing a learner with no recommendation can open the course where that learner left off
Given learner A has no recommendation, and learner A last worked in "Unit 3"
And a member of course staff last worked somewhere in the course other than "Unit 3"
When the staff member opens learner A's progress page
Then selecting the notice's "Resume course" button opens "Unit 3"
Scenario: Course staff viewing the course as a specific learner see what the server returns for that session
Given a member of course staff is viewing the course as learner A
And the server returns the recommendation to retake "Poetry Assignment 1", to demonstrate "Writing Poetry", whose criterion on it requires 80% or better, for that session
When the staff member opens the course's Progress tab
Then the notice reads "Retake Poetry Assignment 1 and score 80% or better to demonstrate Writing Poetry."
And the request for the recommendation names no learner
Scenario: The notice shows the current recommendation after the learner returns from a subsection
Given the learner opened the course's Progress tab, and the notice read "Take Quiz 1 and score 80% or better to demonstrate Analysis."
And the learner selected the notice's button, submitted "Quiz 1", and the server now recommends taking "Quiz 2"
When the learner selects the course's Progress tab again
Then the notice shows the recommendation for "Quiz 2"
And "Quiz 1" doesn't appear in the notice
Scenario: The notice shows the current recommendation after the learner uses the browser's Back button
Given the learner opened the course's Progress tab, and the notice read "Take Quiz 1 and score 80% or better to demonstrate Analysis."
And the learner selected the notice's button, submitted "Quiz 1", and the server now recommends taking "Quiz 2"
When the learner uses the browser's Back button to return to the Progress tab
Then the notice shows the recommendation for "Quiz 2"
And "Quiz 1" doesn't appear in the notice
Scenario: Each form of the sentence is translated as a whole
Given the learner's language is one whose translations put the subsection, the score, and the competencies in a different order than English
When the learner opens the course's Progress tab
Then whichever form of the notice applies (Continue, Take, or Retake, with or without a score, or the "Resume course" button) appears in the translation's word order
And the button's label is translated
And the score is written the way that language writes percentages
And the competency names are joined the way that language writes a list
Scenario: A screen reader user hears the notice as one sentence
Given the learner's recommendation is to retake "Poetry Assignment 1"
When a screen reader user moves through the right-hand CBE progress panel
Then they hear the notice's heading, followed by the whole sentence in reading order
And the button is announced with its label after the sentence, and can be reached and selected with the keyboard alone
Scenario: A keyboard and screen reader user can use the "Resume course" button
Given the learner has no recommendation and the notice shows the "Resume course" button
When the learner moves through the right-hand CBE progress panel with the keyboard and a screen reader
Then the button can be reached and selected with the keyboard alone
And the button is announced with its label
Scenario: The notice reflows on a small screen
Given the learner's recommendation is for a subsection with a long name, to demonstrate three competencies with long names
When the learner opens the course's Progress tab at a phone-sized viewport
Then the notice's sentence wraps onto more lines instead of being cut off
And the page doesn't scroll horizontallyTechnical Details
This is a suggested approach, not the source of truth. The User Story, Description, and Acceptance Criteria define what must be true when the work is done.
Summary
RecommendedNextAction is a self-contained component that #743's Course Progress card renders. It fetches #754's response through the plugin's own react-query client, keyed by course and target learner, and builds one whole translated sentence from it, followed by a button to the subsection: a verb chosen by reason, the subsection's name, an optional score that satisfies every listed criterion, and the competency names as a locale-aware list. The cached response is removed whenever the notice unmounts, so returning to the Progress tab always fetches the current recommendation, and a local error boundary keeps a crash in the notice from hiding the rest of the panel.
Approach
-
Request. Add
getRecommendedNextAction(courseId, targetUserId)tosrc/data/api.js. It calls [BE] GET Recommended Next Action for CBE Learner in Course #754's route,{LMS_BASE_URL}/api/cbe_learner/v1/next-action/{course_key}, throughgetAuthenticatedHttpClient(). The optional learner id is a path segment,/{student_id}, only whentargetUserIdis set. AdduseRecommendedNextAction()tosrc/data/apiHooks.js. It reads{ courseId, targetUserId }fromuseProgressRouteParams(), uses the query key['recommendedNextAction', courseId, targetUserId ?? null], and passes the query client fromsrc/data/queryClient.js([FE] Build cards displaying Competency Criteria on the Course Progress page #734) asuseQuery's second argument, so that client'sQueryCache.onErrorlogs a failed request and a 4xx isn't retried. LeaveplaceholderDataunset, so staff switching learners see nothing until the new learner's response arrives. -
Freshness. Set
gcTime: 0on this query, so its cache entry is removed as soon as the notice unmounts. The notice's buttons are plain links, so following one is a full page navigation away from the Progress tab, so on return the plugin and its query client usually start fresh.gcTime: 0covers in-app remounts, for example staff switching learners or a remount inside the app, which trigger a new request and show nothing until it lands, rather than the previous recommendation followed by a swap. Also callqueryClient.resetQueriesfor this key on apageshowevent whosepersistedis true, because the browser's Back button can restore the Progress tab from the back-forward cache without remounting anything. Thepageshowlistener lives in auseEffectinside the inner component from step 7 and is removed on unmount. -
What renders. [FE] Right Side Course Competency Progress #743 mounts the right-hand panel only in a course with competency criteria, so this component adds no criteria check of its own. It renders:
- the sentence and its button, when
reasoniscontinue_available,retry_available, ornot_startedandnext_actionis present; - otherwise, the "Resume course" button, when
resume_urlis non-null, for any otherreason, including one [BE] GET Recommended Next Action for CBE Learner in Course #754 adds later; - otherwise, nothing: while loading, after a failed request, for
no_criteria_in_course(which [FE] Right Side Course Competency Progress #743's panel normally prevents), or whenresume_urlis null.
The component renders nothing when there is no data. The plugin client's
QueryCache.onErrorlogs a failed request, so the component doesn't branch onisError. If a background refetch fails while cached data exists, the cached data keeps rendering. - the sentence and its button, when
-
Threshold. Add
combineThreshold(criteria)tosrc/ruleText.js, reusing the recognition that [FE] Build cards displaying Competency Criteria on the Course Progress page #734'sformatRuleTextalready does (rule typeGrade,opofgte,lte, oreq,scaleofpercent), so the notice and the rule lines recognize the same rules. Each criterion's rule is atcriterion.rule.rule_typeandcriterion.rule.rule_payload, andrule_payload.valueis a fraction from 0.0 to 1.0.combineThresholdreceives every entry incriteria[]and returns{ op, value }or null. Apply these in order and stop at the first that matches:- when two criteria share a
competency_namebut differ inopor value, null, because the notice is naming that competency once and can't tell which group's score the learner needs; - when every criterion is
gte, the highest value; - when every criterion is
lte, the lowest value; - when every criterion is
eqwith the same value, that value; - when the ops are mixed, the
eqvalues differ, or any rule is unrecognized, null, which drops the "and score" clause. An unrecognized rule is logged once per response, as [FE] Build cards displaying Competency Criteria on the Course Progress page #734's transform does.
Format the value with
intl.formatNumber(value, { style: 'percent', maximumFractionDigits: 2 }), as [FE] Build cards displaying Competency Criteria on the Course Progress page #734 does. - when two criteria share a
-
Competency names. Take
competency_namefromcriteria[]in server order, keeping only the first occurrence of each name, so a competency with two criteria on the subsection, or two competencies that share a name, are named once. Join the names withintl.formatList(names, { type: 'conjunction' }). -
Messages. Add to
src/messages.jsone whole-sentence message per verb and threshold form, twelve in all: Continue, Take, and Retake, each with "{percent} or better", "{percent} or lower", "exactly {percent}", and no score. Add the button labels ("Continue assignment", "Take assignment", "Retake assignment", and "Resume course") and the heading as well. Render the heading as anh3, unless [FE] Right Side Course Competency Progress #743's card defines its heading levels, in which case use the level below the card's title. The notice container follows the UX design and defaults to plain markup inside [FE] Right Side Course Competency Progress #743's card. The message values aresubsection(subsection.display_namein bold, not a link),percent, andcompetencies. Select the message with a lookup keyed by verb and op. Below the sentence, render a ParagonButtonwithhrefset tonext_action.url, which renders a link styled as a button that opens in the same tab; the "Resume course" button usesresume_urlthe same way. The heading is title case with an arrow icon, and the card's colors and border follow the UX design. Check Paragon'sCardandAlertbefore writing custom CSS for the card. -
Error boundary. Split the component in two. The outer
RecommendedNextActionrendersErrorBoundaryfrom@edx/frontend-platform/react, as [FE] Let the operator choose to replace the Course completion and Grades cards with CBE Progress #839 does, around the innerRecommendedNextActionContent, which callsuseRecommendedNextAction()and renders. A hook can't be wrapped by a boundary inside the same component. That boundary logs the error throughlogError. Pass an empty fragment asfallbackComponent, because a falsy fallback makes the boundary render its full-page error, andSilentErrorFallbackwould log the error a second time. Anext_actionwith an emptycriteria[]is malformed but doesn't throw on its own, so throw for it explicitly, and the boundary hides the notice and logs it.
The tests must cover these edge cases:
- each case of the threshold rule in step 4;
- a competency with two criteria on the subsection, and two competencies sharing a name, each named once, with and without matching scores;
- each of the three verbs and its button label;
no_criteria_in_courserendering nothing;- competency names kept in server order;
- switching
targetUserIdnever showing the previous learner's sentence; - a remount fetching again and showing nothing until the response lands;
- a
reasonother than the three recommendation reasons, both with and withoutresume_url; - an empty
criteria[]; - the error boundary hiding the notice when rendering throws;
- the
pageshowreset whenpersistedis true; - one translated word order that differs from English.
- tutor-mfe pin. Once a package release includes this ticket, open a pull request to
overhangio/tutor-mfethat moves the pinned package version [FE] Bundle the CBE Student Progress widgets with tutor-mfe #828 adds to that release, and verify it on a Learning MFE image rebuilt from that branch. Until a tutor-mfe release includes that pull request, Tutor sites show the Course Progress card without the Recommended Next Action notice.
Out of scope:
- a click-tracking event on the button;
- polling for a newer recommendation: a Progress tab left open in another browser tab shows its recommendation until it is reloaded;
- linking the notice to the competency cards through
criterion_idortag_id.
Files to create and modify
Paths are relative to the root of the plugin repository from #810.
| File | Change |
|---|---|
src/RecommendedNextAction.jsx |
new: the outer RecommendedNextAction with the error boundary, and the inner RecommendedNextActionContent with the sentence and buttons |
src/ruleText.js |
modified: add combineThreshold |
src/messages.js |
modified: add the sentence, button label, and heading messages |
src/data/api.js |
modified: add getRecommendedNextAction |
src/data/apiHooks.js |
modified: add useRecommendedNextAction |
| The Course Progress card component from #743 | modified: render RecommendedNextAction |
tutormfe/plugin.py in overhangio/tutor-mfe |
modified: wherever #828 declares the package's pinned version, most likely this file, otherwise tutormfe/templates/mfe/build/mfe/Dockerfile |
Additional context
- [FE] Right Side Course Competency Progress #743's Course Progress card renders this notice. [FE] Right Side Course Competency Progress #743 limits the panel to courses with competency criteria because every mount calls [BE] GET Recommended Next Action for CBE Learner in Course #754, an expensive endpoint.
- [BE] GET Recommended Next Action for CBE Learner in Course #754 never recommends retaking a subsection whose score is hidden from the learner, so the notice renders [BE] GET Recommended Next Action for CBE Learner in Course #754's response without [FE] Display Subsection Competency Statuses for Learner in Course #739's score masking.
- Group and competency statuses roll up asynchronously (openedx-core ADR 0004,
docs/openedx_learning/decisions/0004-competency-mastery-concurrency.rst). Right after a learner demonstrates one subsection in an OR group, [BE] GET Recommended Next Action for CBE Learner in Course #754 can briefly still recommend an untouched sibling. [BE] GET Recommended Next Action for CBE Learner in Course #754 accepts this lag, and the notice shows whatever [BE] GET Recommended Next Action for CBE Learner in Course #754 returns. - In
@edx/frontend-platform,src/react/ErrorBoundary.jsxshows the logging and fallback behavior that step 7 relies on.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsFinal Axim Review
Activity
[-][Placeholder - FE] Build display of recommended next action in right hand CBE progress panel.[/-][+][FE] Build Display of Recommended Next Action[/+]thelmick-unicon commentedon Oct 27, 2026
The discussion period for this ticket is now complete, and we appreciate all the feedback. We'll be moving forward with development based on the current ticket pending final Axim sign-off. That said, the conversation doesn't have to stop. If you still have feedback, please continue to add to this ticket. We'll review anything new and determine whether it fits within the current timeline or makes more sense as its own ticket for future work. Thanks again for helping make this better!
@jmakowski1123 This is ready for your final review. Thank you!