Skip to content

Fixes sort-by's handling of multiple keys #375

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

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

lukemelia
Copy link
Contributor

@lukemelia lukemelia commented Jun 10, 2020

  • Prior to this change, passing multiple keys to sort-by resulted in the target array being sorted by the first key and then the whole thing being resorted by each subsequent key. The ultimate result was determined solely by the last key. This is not the intended behavior.
  • The desired behavior (and the behavior of this addon prior to 4.1.0) is for the second and subsequent sort keys only to be applied in the case where the first sort key does not yield a clear ordering.
  • The test for this case uses the very common example of sorting people by last name then first name, as is shown in the README
  • This commit also consolidates the code path taken when a sort function is passed in place of a sort key

@lukemelia lukemelia force-pushed the bug/sort-by-multiple-keys branch from a4751a6 to ab2c9da Compare June 10, 2020 09:43
- Prior to this change, passing multiple keys to `sort-by` resulted in the target array being sorted by the first key and then the whole thing being resorted by each subsequent key. The ultimate result was determined solely by the last key. This is not the intended behavior.
- The desired behavior (and the behavior of this addon prior to 4.1.0) is for the second and subsequent sort keys only to be applied in the case where the first sort key does not yield a clear ordering.
- The test for this case uses the very common example of sorting people by last name then first name, as is shown in the README
- This commit also consolidates the code path taken when a sort function is passed in place of a sort key
@lukemelia lukemelia force-pushed the bug/sort-by-multiple-keys branch from ab2c9da to 01e1caf Compare June 10, 2020 10:24
Copy link
Contributor

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THis is a really nice addition!! Thank you!!

@snewcomer snewcomer merged commit 45f2133 into DockYard:master Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants