- /api/lists/{id}/ seems to return the tools in the order they were added in to the list
- /api/lists/{list_pk}/revisions/{id}/ seems to return the tools in alphabetical order
Description
Details
Related Objects
Event Timeline
Change 777457 had a related patch set uploaded (by Raymond Ndibe; author: Raymond Ndibe):
[wikimedia/toolhub@main] api: same ordering for lists and list revision
This patch has a weird bug.
To reproduce:
- Create a new empty list.
- Add the tool "Wiki Loves Monuments maps" to it
- Go to MyLists: everything here looks good
- Go to the list's List History, click on the most recent Revision
Expected behavior:
There is a list with a "Wiki Loves Monuments maps" ToolCard in it.
What really happens:
There are several "Wiki Loves Monuments maps" ToolCards in the list.
I created three different lists, each containing the "Wiki Loves Monuments maps" tool. When inspecting the latest revision,
- the first list had 2 "Wiki Loves Monuments maps" ToolCards
- the second had 3
- the third had 4!
I tried doing the same thing on the main branch, but everything worked fine there.
Yes this is a weird bug and really interesting reading about it. I went through a couple of django issues before discovering this a known won't fix issue and was opened and closed 10 years ago. here is the link https://code.djangoproject.com/ticket/18165.
The first solution that solves it satisfactorily is to use .distinct(), but I can't say with confidence that this is the best solution. I'll submit a match with the distinct() approach however. If someone knows of a better solution, I'd be glad to talk about it.
Change 777457 merged by jenkins-bot:
[wikimedia/toolhub@main] api: same ordering for lists and list revision
Change 786342 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):
[operations/deployment-charts@master] toolhub: Bump container version to 2022-04-21-215651-production
Change 786342 merged by jenkins-bot:
[operations/deployment-charts@master] toolhub: Bump container version to 2022-04-21-215651-production