You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(create): persist and display Demo and Module item ordering #182
Reordering exercises in the Demo editor must persist and display in the configured top-to-bottom order. Module resource selection must support adding several resources into a visible draggable list, preserving its top-to-bottom order across save and reload.
Scope and approach\
Demo exercises
Retain the existing DemoExercises.order schema and update behavior; no new Demo ordering model or migration is needed.
Ensure the learner-facing GET /api/demos/:uid/attempt query orders exercises by DemoExercises.order ASC.
Verify the existing Demo editor drag state is submitted as the ordered exercise-ID array and is restored after saving and reopening.
Module resources
Add an ordering column to ModuleResources, with a deterministic backfill.
Introduce/register an explicit ModuleResources join model and use it for the Module-Resource association.
On module creation and update, persist each resource association using the submitted resource-ID order.
Apply resource ordering to every relevant read path: module create/update reloads, module GET/list, course/student-course payloads, and the module-resource SQL used by the Demo attempt endpoint.
Replace the Module form’s multiselect presentation with a cleared single-select picker and visible selected-resource rows below it. Exclude already selected resources, allow removal, and reuse the existing @dnd-kit sortable interaction for top-to-bottom reordering.
Correct the Module draft type so its resource state is ordered IDs (or equivalent selected-item data), removing the existing Resource[]/ID mismatch and @ts-ignore workarounds.
Acceptance criteria\
Dragging and saving a Demo’s exercises preserves that order when reopening its editor and on the learner Read view
A Module user can select multiple resources one at a time; each appears below the selector, can be removed, and can be reordered by drag-and-drop.
Saving and reopening a Module retains the configured resource order.\n- [ ] Module resources are returned in that order from all affected API/read paths.
Tests cover persisted/retrieved API ordering plus Demo and Module editor interactions.
Verification
API tests for Demo attempt exercise order and Module resource order after update/reload.
Component or Cypress coverage for Demo drag-save-reopen and Module multi-select, reorder, save, and reopen.
Run the relevant test suites and production client/API builds.
Use a zero-based ModuleResources.ordering value: the first resource is 0, then 1, and so on. The migration backfill, create/update writes, and every ordering clause must use this same convention. This aligns with the existing DemoExercises.order behavior.
For every module or course fetch that includes Module.resources, apply the nested Sequelize order for ModuleResources.ordering ASC. This explicitly includes module GET/list, module create/update reloads, teacher and student course payloads, and the module-resource SQL in the Demo attempt endpoint.
The resource picker must exclude resources already in the selected list. Removing a resource updates the ordered submitted ID array immediately. When editing an existing Module, initialize the visible resource rows from the API-returned resource order.
Each selected-resource row must include a delete/remove button, equivalent to the trash button in the Demo exercise ordering list. Selecting it removes that resource from the visible list and from the ordered resource IDs that will be saved.
PR #183 merged the core feature while its requested follow-up fixes and verification were still being added. Reopening until #185 lands; #185 corrects Demo drag direction and adds the missing API/unit/browser ordering coverage.
Activity
kbuffardi commentedon Aug 21, 2026
Specification clarification — index convention:
Use a zero-based
ModuleResources.orderingvalue: the first resource is0, then1, and so on. The migration backfill, create/update writes, and every ordering clause must use this same convention. This aligns with the existingDemoExercises.orderbehavior.kbuffardi commentedon Aug 21, 2026
Specification clarification — read-path coverage:
For every module or course fetch that includes
Module.resources, apply the nested Sequelize order forModuleResources.ordering ASC. This explicitly includes module GET/list, module create/update reloads, teacher and student course payloads, and the module-resource SQL in the Demo attempt endpoint.kbuffardi commentedon Aug 21, 2026
Specification clarification — Module editor state:
The resource picker must exclude resources already in the selected list. Removing a resource updates the ordered submitted ID array immediately. When editing an existing Module, initialize the visible resource rows from the API-returned resource order.
kbuffardi commentedon Aug 21, 2026
UI requirement — resource removal:
Each selected-resource row must include a delete/remove button, equivalent to the trash button in the Demo exercise ordering list. Selecting it removes that resource from the visible list and from the ordered resource IDs that will be saved.
feat(create): persist ordered module resources
test(ordering): cover persisted module and demo order
kbuffardi commentedon Sep 14, 2026
PR #183 merged the core feature while its requested follow-up fixes and verification were still being added. Reopening until #185 lands; #185 corrects Demo drag direction and adds the missing API/unit/browser ordering coverage.
test(ordering): cover persisted module and demo order
kbuffardi commentedon Sep 14, 2026
#185 closed #183