Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #411
What does this PR do / solve?
Currently the sort playlist feature is using the index and paylistname data attributes to sort by date and alphabet. The issue is that I did not realize that the array sort function takes into consideration lower and upper case when sorting.
Also the index is being sorted as a string rather than a number which causes the playlist to be in the incorrect order when sorting by date.
Overview of changes
The sort function will now lower case all playlist titles and convert index strings into numbers before sorting to prevent these bugs.
How to test this PR?
If you currently sort the playlist with a user who has more than 10 playlists https://openwhyd.org/adrien/playlists the inspector shows an unexpected sort behavior.
After this update the sort by date will sort the playlist by the
![Screenshot from 2020-11-29 08-30-47](https://user-images.githubusercontent.com/13477167/100548186-e8709780-321f-11eb-8d77-ae2798c2e9be.png)
data-index
attribute by ascending order:When using the alphabetize sort option the playlist will now correctly get ordered using the
![Screenshot from 2020-11-29 08-31-17](https://user-images.githubusercontent.com/13477167/100548276-5f0d9500-3220-11eb-8f68-f56e2d48ad48.png)
data-playlistname
as expected regardless if the title is capitalized: