Skip to content
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

Albums with rating of 0 precede all others in Album List #1352

Closed
lazka opened this issue Mar 15, 2015 · 4 comments
Closed

Albums with rating of 0 precede all others in Album List #1352

lazka opened this issue Mar 15, 2015 · 4 comments
Labels

Comments

@lazka
Copy link
Member

lazka commented Mar 15, 2015

Original issue 1352 created by danielkza2 on 2014-03-20T03:11:09.000Z:

Quodlibet version: 3.0.99 from Fedora 20 unstable repo.

Albums with a total rating of 0.0 (I noticed because I have lots of unrated albums and set the default rating to 0) sort before everything else in the Album List browser.

This is caused by a mistake in the sorting function in quodlibet/browsers/albums/main.py:

def __compare_rating(self, model, i2, i1, data):
    a1, a2 = model.get_value(i1, 0), model.get_value(i2, 0)
    if (a1 and a2) is None:
        return cmp(a1, a2)
    return (cmpa(a1("~#rating"), a2("~#rating")) or
            cmpa(a1.date, a2.date) or
            cmpa(a1.sort, a2.sort) or
            cmp(a1.key, a2.key))

Notice the use of cmpa for the rating: it causes the 'falsy' value of 0 to be treated as infinity, and therefore sort before everything else. I believe plain cmp should be used instead.

@lazka
Copy link
Member Author

lazka commented Mar 15, 2015

Comment #1 originally posted by reiter.christoph on 2014-03-20T07:16:46.000Z:

<empty>

@lazka
Copy link
Member Author

lazka commented Mar 15, 2015

Comment #2 originally posted by reiter.christoph on 2014-03-20T13:20:25.000Z:

This issue was closed by revision 218115b.

@lazka
Copy link
Member Author

lazka commented Mar 15, 2015

Comment #3 originally posted by reiter.christoph on 2014-03-20T13:22:49.000Z:

Thanks, should be in the fedo repo in a few minutes.

@lazka
Copy link
Member Author

lazka commented Mar 15, 2015

Comment #4 originally posted by reiter.christoph on 2014-04-01T11:49:01.000Z:

This issue was closed by revision bbdc1d3.

@lazka lazka closed this as completed Mar 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant