Skip to content

[FE] Manage & Apply Competencies: delete a Competency Criteria Association #710

Open

Description

@thelmick-unicon

Use Case

As a course author who associated the wrong gradeable subsection with a Competency Rule Group, or no longer wants a subsection counted toward a competency, I want to remove a single association from a Competency Rule Group box's Selected Content list, so that I can correct the rule's content without deleting or recreating the whole box.

Acceptance Criteria

Frontend ticket. Testable once #672's Selected Content list and #670's Browse Courses panel chip exist, #674 exists, and #709's group-removal rendering logic exists.

Scenario: Remove an association via its Competency Rule Group box item
  Given a gradeable subsection is associated with a Competency Rule Group box, among other associations in the same box
  When I click the remove ("X") affordance on that association's item in the box's Selected Content list
  Then that association is removed
  And the item no longer appears in the box's Selected Content list
  And the subsection's chip in the Browse Courses panel no longer shows it as already-associated, and it is selectable again
  And the box's other associations remain unchanged

Scenario: Remove an association via its Browse Courses panel chip
  Given a gradeable subsection is associated with a Competency Rule Group box, among other associations in the same box
  When I click the remove ("X") affordance on that subsection's already-associated chip in the Browse Courses panel
  Then that association is removed
  And the subsection's chip in the Browse Courses panel no longer shows it as already-associated, and it is selectable again
  And the item no longer appears in the box's Selected Content list
  And the box's other associations remain unchanged

Scenario: Removing the last association empties a box with siblings present
  Given a Competency Rule Group box has exactly one association, and other boxes exist for the competency
  When I remove that association, from either its Selected Content item or its Browse Courses panel chip
  Then the now-empty box is removed from the page
  And the competency's other boxes remain unaffected

Scenario: Removing the last association from the only remaining box
  Given a Competency Rule Group box has exactly one association, and it is the only box for the competency
  When I remove that association, from either its Selected Content item or its Browse Courses panel chip
  Then the box is removed
  And the panel shows the same empty-state message as a competency with no associations
  And no box is the active target, so a gradeable subsection I select afterward is added under a new Course Group for its course

Scenario: Backend rejects the removal
  Given a remove request to the backend fails
  When I click the remove affordance on an association, from either entry point
  Then the association remains visible in the box's Selected Content list, and its Browse Courses panel chip still shows it as associated
  And an error is shown, following this feature's existing generic-error-handling pattern

Scenario: A course author without write access cannot remove an association
  Given I lack studio write access to the course the association's subsection belongs to
  Then neither the Selected Content item's remove affordance nor the Browse Courses panel chip's remove affordance is rendered

Screenshot below illustrates some of the workflow, but the Figma tells the story.

Image Image

Description

This ticket adds a remove/deselect action to a single Selected Content item, letting a course author remove one subsection's association from a Competency Rule Group box without affecting that box's other associations.

Current behavior

An associated subsection is currently visible in two places at once: as an item in its Competency Rule Group box's Selected Content list (SelectedContentItem, built "display only, no deselect action" by #672), and as an already-associated chip on the subsection itself in #670's Browse Courses panel. Neither currently offers a way to remove the association; the only "undo" available is deleting the entire Competency Rule Group box (#709), which removes every other association in it too.

Requested change

  • Both of that association's existing chips gain a remove/deselect "X": the one on its item in the Competency Rule Group box's Selected Content list, and the one on the subsection's own chip in [FE] Competency Management Course Search/View #670's Browse Courses panel.
  • Clicking either X removes the same one association via [BE] Delete Competency Criterion #674; the Competency Rule Group box, its logic operator, and its other associations are unaffected. Both surfaces are rendered from the same GET-backed association data, so removing from either X updates both at once: the item disappears from the box's Selected Content list, and the subsection's chip in the Browse Courses panel visibly reverts to unassociated, selectable again.
  • If removing an association empties its Competency Rule Group box, [BE] Delete Competency Criterion #674 deletes that now-empty box in the same call (see Technical Details). The box simply disappears from the page if sibling boxes remain, or the panel shows its empty-state message if it was the last one, per [FE] Delete Competency Course & Rule Groups #709's existing rendering logic, reused here rather than re-implemented.
Out of scope
Technical Details

Data Structures

Logic

  • Both entry points call the same useDeleteCompetencyCriterion hook: SelectedContentItem's new remove affordance (in the Competency Rule Group box), and the matching remove affordance added to the subsection's already-associated chip in [FE] Competency Management Course Search/View #670's Browse Courses panel.
  • On success: the invalidated GET query drops the removed association from both surfaces at once, since both render from the same GET-backed data — the item disappears from the box's Selected Content list, and the subsection's Browse Courses panel chip reverts to unassociated and selectable.
  • Because [BE] Delete Competency Criterion #674 cascades an emptied box away server-side, this ticket does not call [FE] Delete Competency Course & Rule Groups #709's delete endpoint. It does reuse [FE] Delete Competency Course & Rule Groups #709's activeGroupId-recomputation logic (not its API call) once the GET refetch reflects the box's removal, so the active target stays consistent with [FE] Delete Competency Course & Rule Groups #709's rules (falls back to a remaining sibling box, or to no active target and the empty-state message if none remain).
  • On delete failure, leave the association visible on both surfaces and follow [FE] Create & View Competency Criteria #672's generic error-handling pattern.
  • No confirmation dialog: Use Case 10's job.
  • Neither remove affordance is rendered at all — not merely disabled — for a course author without studio write access to the course.

Example Resolution Prompt

Implement the frontend consumer of #674 in frontend-app-authoring, extending #671/#672's src/taxonomy/competency-management/criteria-groups/ directory (check whether #709 already added data/api.ts/data/apiHooks.ts entries before adding new ones). Add deleteCompetencyCriterion and useDeleteCompetencyCriterion per Technical Details → Data Structures. Add a remove affordance to SelectedContentItem.tsx (from #672) and a matching one to #670's already-associated subsection chip in the Browse Courses panel, both wired to this hook per Technical Details → Logic. Since #674 cascades an emptied box away server-side, do not call #709's delete endpoint; reuse only its activeGroupId-recomputation logic once the GET refetch reflects the box's removal. Hide (not disable) both remove affordances without studio write access. No confirmation dialog (Use Case 10's job). Follow #672's generic error-handling pattern on failure.

Context

Files to create and modify

Modified files (conditional: check whether #671/#672/#709 already created these before adding new content)

File Nature of modification
src/taxonomy/competency-management/criteria-groups/SelectedContentItem.tsx (from #672) Add a remove ("X") affordance wired to useDeleteCompetencyCriterion; hidden without studio write access.
#670's Browse Courses panel's subsection-row component (path TBD, not yet built) Add a remove ("X") affordance to an already-associated subsection's chip, wired to the same useDeleteCompetencyCriterion hook; hidden without studio write access.
src/taxonomy/competency-management/data/api.ts Add deleteCompetencyCriterion.
src/taxonomy/competency-management/data/apiHooks.ts Add useDeleteCompetencyCriterion.

Frontend implementation in frontend-app-authoring. Parent design: #648. Foundation this builds on: #670, #671. Sibling on the same page: #672 (creates the associations this ticket deletes), #709 (deletes a whole Competency Rule Group box — this ticket reuses its activeGroupId-recomputation and empty-state fallback rendering logic when emptying a box's last association).

Blocked by: #674 (backend delete-association endpoint, which also cascades an emptied box away server-side); #672 (builds SelectedContentList/SelectedContentItem as "display only, no deselect action" — this ticket adds that action); #709 (the activeGroupId-recomputation rendering logic this ticket reuses when a box empties); #681 (GET groups + criteria endpoint).

Activity

  1. moved this from Needs additional details to Ready for Community Review in Competency Criteria and Student Progresson Aug 3, 2026
  2. moved this from Ready for Community Review to Final Axim Review in Competency Criteria and Student Progresson Aug 21, 2026
  3. thelmick-unicon commented on Aug 21, 2026

    @thelmick-unicon
    Author

    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!

  4. illiphilli commented on Aug 21, 2026

    @illiphilli

    Screenshot below illustrates some of the workflow, but the Figma tells the story.

    Image
  5. thelmick-unicon commented on Aug 24, 2026

    @thelmick-unicon
    Author

    @jmakowski1123 This is now ready for your final review, thank you!

  6. 2 remaining items

  7. jmakowski1123 commented on Sep 21, 2026

    @jmakowski1123

    Testing an assumption - If I remove the last association and the placeholder box is all that remains, it can remain empty, right? As in, a user changes their mind and decides not to associate anything.

  8. mgwozdz-unicon commented on Sep 21, 2026

    @mgwozdz-unicon
    Contributor

    @jmakowski1123 If the user removes the last association, then the placeholder will be removed as well. But the user would be able to put it back using the "+ Rule Group" or "+ Rule" buttons or just click on another subsection to associate it.

    Scenario: Removing the last association empties a box with siblings present
      Given a Competency Criteria Group box has exactly one association, and other boxes exist for the competency
      When I remove that association, from either its Selected Content item or its Browse Courses panel chip
      Then the now-empty box is removed from the page
      And the competency's other boxes remain unaffected
  9. jmakowski1123 commented on Sep 28, 2026

    @jmakowski1123

    Sounds good. This is approved.

  10. illiphilli commented on Oct 12, 2026

    @illiphilli

    @thelmick-unicon @AShatsila no change to this flow, since chips keep their ✕. But the screenshots showed trash icons on groups and rule boxes, which are now ⋮ menus (#775). These replace the two in the description. The Figma link is unchanged.

    Image Image
  11. moved this from In Progress to Unicon Code Review in Competency Criteria and Student Progresson Oct 19, 2026
  12. moved this from Unicon Code Review to Community Code Review in Competency Criteria and Student Progresson Oct 26, 2026
  13. moved this from Community Code Review to Ready for QA in Competency Criteria and Student Progresson Nov 24, 2026
  14. dvarenikqaconsultant commented on Nov 25, 2026

    @dvarenikqaconsultant

    Test report: #710 [FE] Manage & Apply Competencies: delete a Competency Criteria Association

    Environment: Master Sandbox (https://apps.master.openedx.io/authoring/taxonomy/<id>/competencies)
    Build under test: frontend-app-authoring PR openedx/frontend-app-authoring#3378, with the delete endpoint from openedx-core PR #879 (openedx-core 1.28.0)
    Test users: dmitryvarenikqa (staff, course author); test670 (non-staff, no write access to the test course); qa699a (learner, used to create mastery progress)
    Test type: UI testing in Studio, with DevTools Network for the request and response checks and Postman for the API checks
    Overall result: Passed. Every acceptance criteria scenario passed, except the UI part of "A course author without write access cannot remove an association", which cannot be verified on Master Sandbox (see below). The backend part of that scenario passed. No bugs were found.

    Test data: courses course-v1:QA710+C1+2026, course-v1:QA710+C2+2026, course-v1:QA710+C3+2026 and course-v1:QA709+A+2026, and competency taxonomies "QA710 Competencies" and "QA710 Manual Check" (one competency per test case, with the associations created in advance).

    Removing an association

    Scenario Result
    Remove an association via its Competency Rule Group box item Pass. The ✕ on the chip sends one DELETE request, which returns 200, and the panel is refetched. The chip disappears, the other chips in the rule box stay, and the subsection in the Courses & Content panel loses its competency badge and can be selected again. No toast is shown. Keyboard focus moves to the Rule Group card. The association is still gone after a page reload.
    Remove an association via its Browse Courses panel chip Pass. The ✕ next to the competency badge in the Courses & Content panel gives the same result. Keyboard focus moves to the select button of the same subsection row.
    Removing the last association empties a box with siblings present (chip and panel) Pass. When the removed chip was the last one in its Rule Group, that Rule Group disappears and the other Rule Group is unchanged. The selection moves to the remaining Rule Group (it had been on the removed one before the delete), and the next selected subsection is added to it.
    Removing the last association from the only remaining box (chip and panel) Pass. The panel shows the empty state "No content associated with <competency> yet." with the hint "Make content selections to create competency criteria associations.", and focus moves to that message. The next selected subsection creates a new Course Group without an error.

    Errors and permissions

    Scenario Result
    Backend rejects the removal (chip and panel) Pass. The DELETE request was blocked, and in a second run it returned 500. Both times the toast "There was a problem removing this association. Please try again." appeared, the chip and the panel badge stayed in place, and the association still existed on the server. Focus returned to the ✕ button.
    A course author without write access cannot remove an association (backend) Pass. A DELETE request sent as test670 for an association in a course where that user has no role returned 403 "You do not have permission to perform this action.", and the association stayed.

    Not verified on Master Sandbox

    A course author without write access sees no ✕ (UI part of the permission scenario). This part cannot be reproduced on Master Sandbox. The frontend decides whether a course is editable from the global value of the authz.enable_course_authoring waffle flag. On Master Sandbox that flag is off globally, so the page treats every course as editable for every user and always shows the ✕ buttons. Verifying the UI part requires an environment with the flag enabled. The backend still refuses the removal, as shown above.

    Additionally tested

    • Removing the only association of a course removes that course's whole section from the panel, while the other course's section stays. The API confirms that the empty Course Group was deleted on the server.
    • Removing the only chip of the 90% rule box removes only that rule box. The Rule Group and its 80% rule box stay, the selection moves to the 80% rule box, and the next selected subsection is added there.
    • Removing an association whose subsection already has learner progress behaves in the UI exactly like a normal removal. The DELETE response is 200 with archived: true, and the panel no longer shows the association. A later attempt to associate the same subsection with the same competency returns 400 ("This content was previously associated with this competency and the association was archived."), and the page shows the toast "There was a problem creating this association. Please try again."
    • Removing an association that another author had already deleted through Postman returns 404 from the page's DELETE request. No error is shown, and the stale chip disappears after the refetch.
    • When the same subsection is associated in two Rule Groups, the ✕ on a chip removes only that Rule Group's association. The ✕ in the Courses & Content row removes one of the two associations, and the row keeps its badge while the other association exists.
    • When a subsection is associated with two competencies, removing one association removes only that competency's tag from the subsection. The other competency's tag stays.
    • While a removal is in progress (the DELETE request was slowed down), every ✕ button, every ⋮ menu button, and the subsection select buttons are disabled, and only one DELETE request is sent.
    • The ✕ buttons can be reached with Tab and activated with Enter. Both have the accessible name "Remove the association with <subsection name>".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions