edsl icon indicating copy to clipboard operation
edsl copied to clipboard

Results `sort_by()` method does not behave as expected

Open rbyh opened this issue 9 months ago • 4 comments

I expect it to sort fields in the order that I have applied it, but it does it in reverse: image

rbyh avatar May 08 '24 11:05 rbyh

Can you say a bit more here - what's the expected behavior?

johnjosephhorton avatar May 10 '24 09:05 johnjosephhorton

If I sort by column A, and then by column B, I expect column A to remain the first sorted thing (like SQL). But it does the reverse -- it makes column B the first sorted thing.

rbyh avatar May 10 '24 09:05 rbyh

I see. This might be challenging because it would require the dataset to have a "memory" of what is sorted by and I'd prefer to keep it stateless. What about is sorted could take multiple keys, like this:

results.sort_by('a', 'b')

which would sort by a, then b.

johnjosephhorton avatar May 10 '24 10:05 johnjosephhorton

Yes, I would prefer sort_by('a', 'b') but I thought we discussed a reason to not do it that way?

rbyh avatar May 10 '24 11:05 rbyh

New version does sort this way - can you update docs, @rbyh ?

johnjosephhorton avatar Jul 13 '24 17:07 johnjosephhorton