mitodl/open-discussions

(open/learn) Re-ordering learning paths does not always work

Opened this issue · 1 comments

Steps to Reproduce

  1. Create a learning path with multiple items, where the first item in the path has position greater than zero. One way to do this is:
    1. Create a new learning list. Add 5 items. Their positions are 0, 1, 2, 3, 4
    2. Open the "Add/Remove dialog" for first item (bookmark icon). Remove it & add it again. The positions are now 1, 2, 3, 4, 5.
    3. Add/Remove the first item again. The item positions are now 2, 3, 4, 5, 6.
    4. Repeat as desired
  2. On the learning path page at /learn, swap the first and second items.

Expected Behavior

UI and backend both update correctly.

Actual Behavior

UI updates. Reload page => old ordering. The backend and UI had different states.

Screen.Recording.2023-04-14.at.12.14.00.PM.mov

Question: How do we expect the backend to be handling updates to list order? Do we expect that the lists in the database are always 0, 1, 2, ... N, or do we just expect that they are monotonically increasing?