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

1.31.1 breaks priority sorting with decimals #1562

Closed
tripflex opened this Issue Jul 30, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@tripflex
Collaborator

tripflex commented Jul 30, 2018

The update in commit 51ecd6a to use intval on priorities, has broken priority sorting when using decimal places (which is really popular, especially sites with large number of fields).

Was this done just to match PHPCS reports, or was there a specific reason behind this change? I suggest reverting back to original handling for priorities, or switch to using floatval instead

protected function sort_by_priority( $a, $b ) {
if ( intval( $a['priority'] ) === intval( $b['priority'] ) ) {
return 0;
}
return ( intval( $a['priority'] ) < intval( $b['priority'] ) ) ? -1 : 1;

@jom jom added this to the 1.32.0 milestone Jul 31, 2018

@jom

This comment has been minimized.

Show comment
Hide comment
@jom

jom Jul 31, 2018

Member

It was a PHPCS fix, but floatval() works for me.

Member

jom commented Jul 31, 2018

It was a PHPCS fix, but floatval() works for me.

@tripflex

This comment has been minimized.

Show comment
Hide comment
@tripflex

tripflex Aug 16, 2018

Collaborator

@jom I submitted a PR to fix this, LGTM 👍

Collaborator

tripflex commented Aug 16, 2018

@jom I submitted a PR to fix this, LGTM 👍

@jom jom closed this in #1574 Aug 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment