Problem
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\
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.
Problem
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
DemoExercises.orderschema and update behavior; no new Demo ordering model or migration is needed.GET /api/demos/:uid/attemptquery orders exercises byDemoExercises.order ASC.Module resources
orderingcolumn toModuleResources, with a deterministic backfill.ModuleResourcesjoin model and use it for the Module-Resource association.@dnd-kitsortable interaction for top-to-bottom reordering.Resource[]/ID mismatch and@ts-ignoreworkarounds.Acceptance criteria\
Verification