New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort correctly in Bulk Order Managment #10451
Sort correctly in Bulk Order Managment #10451
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great documentation, clean PR, thanks!
Wondering if this worth a spec. @filipefurtad0 what to you think?
Agree @jibees , wondering as well - something like we already to for the orders page. I'd suggest we'd make this check on the file Would you be available to add a test to this PR @cyrillefr? |
Hello @filipefurtad0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, in what the spec concerns. Thanks @cyrillefr !
Seems like a minor code change - should we move it to test ready @jibees ?
Yes! |
Hey @cyrillefr , I've staged the PR and repeated the automated test, on the server with "real" data. Before the PR: After this PR - with the data for this enterprise, I somehow cannot observer the correct ordering: After clicking once on "Completed at", I get: After clicking a second time: This seems to work in some cases, but not always. Could there be another factor interfering in the ordering, on this page? |
Hello @filipefurtad0. |
c7e546a
to
2bd87b4
Compare
Converting date to utc + iso8601 format is sufficient to ensure proper sorting.
2bd87b4
to
e4845f4
Compare
@filipefurtad0 , it should work now. |
Thanks @cyrillefr . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Hi @cyrillefr, Before your PR - clicking 'Completed at' ONCE Before your PR - clicking 'Completed at' TWICE After your PR - clicking 'Completed at' ONCE After your PR - clicking 'Completed at' TWICE ConclusionThis is great improvement, thanks a lot! It's ready to be merged! 🚀 NoteI find it strange that the columns are sorted per page only (and not all results of the query). So on other pages there may be older or newer line items, even if the table is sorted by date. On page /orders the behavior is different and more intuitive, I think. But we can see that each sorting process requires a new database query there - maybe there was a technical reason to implement the BOM page like this. I will do some digging and see if we want to improve this even more. Also the little indicator arrow for ascending and descending might be helpful sometimes. |
What? Why?
Inaccurate sorting @ /admin/orders/bulk_management
Even though so some numeric representation of a Date could be used at first thought, the advantage here is also to get a utc date first then to format it to an ISO8601. No locale in a numeric representation.
Avdi Grimm has a post on it: https://avdi.codes/iso8601-dates-in-ruby/
What should we test?
The same procedure as stated in #9661
I would personally use July, September and August