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

Improve badge ordering #28

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Emilgardis
Copy link
Collaborator

@Emilgardis Emilgardis commented Apr 22, 2023

This has some issues, but posting what I have so far.

The implementation is currently not sufficiently transitive for implementing Ord

@Emilgardis
Copy link
Collaborator Author

Fails on "U/1U,U/11,U/5" for example

it does not satisfy a > b && b > c => a > c

src/badges.rs Outdated Show resolved Hide resolved
match self.set_id.partial_cmp(&other.set_id) {
Some(core::cmp::Ordering::Equal) => {}
// XXX: order known badges like first-party site
// FIXME: is the reflexive and transitive? as needed by Ord
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this needs to be fixed

Copy link
Owner

Choose a reason for hiding this comment

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

How does this fail?

src/badges.rs Outdated
self.id.as_str().parse::<u32>(),
other.id.as_str().parse::<u32>(),
) {
(Ok(s), Ok(other)) if s != other => s.partial_cmp(&other),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"01".parse() == "1".parse(), but they are not equal, this fixes that

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.

2 participants