Skip to content

Improve badge ordering#28

Draft
Emilgardis wants to merge 6 commits into
museun:mainfrom
Emilgardis:badge-improvement
Draft

Improve badge ordering#28
Emilgardis wants to merge 6 commits into
museun:mainfrom
Emilgardis:badge-improvement

Conversation

@Emilgardis

@Emilgardis Emilgardis commented Apr 22, 2023

Copy link
Copy Markdown
Collaborator

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

The implementation is currently not sufficiently transitive for implementing Ord

@Emilgardis

Copy link
Copy Markdown
Collaborator Author

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

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

Comment thread src/badges.rs Outdated
Comment thread src/badges.rs
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
Copy Markdown
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
Copy Markdown
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?

Comment thread 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
Copy Markdown
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

museun and others added 2 commits April 22, 2023 15:46
Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
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