mitodl / open-discussions

BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

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

Open ChristopherChudzicki opened 1 year ago

ChristopherChudzicki commented 1 year ago

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.

https://user-images.githubusercontent.com/9010790/232099343-ac45b815-9425-4812-abfc-072439e48a17.mov

ChristopherChudzicki commented 1 year ago

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?