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

Fix country ranking bugs #54

Merged
merged 9 commits into from
Jun 19, 2024
Merged

Fix country ranking bugs #54

merged 9 commits into from
Jun 19, 2024

Conversation

hburn7
Copy link
Collaborator

@hburn7 hburn7 commented Jun 15, 2024

Fixes a bug with the country ranking algorithm. The ratings collection was not sorted by country, causing this code to basically fail immediately as it is looking for the next item in the list that does not match the current country:

let country_end = country_slice_begin
            .iter()
            .position(|x| x.country != country)
            .unwrap_or(country_slice_begin.len());

Fix was to apply the following before iterating through each country:

ruleset_slice.sort_by(|x, y| x.country.partial_cmp(&y.country).unwrap());

Closes #53

@hburn7 hburn7 added bug Something isn't working area:statistics labels Jun 15, 2024
@hburn7 hburn7 requested a review from 486c June 15, 2024 04:01
@hburn7 hburn7 self-assigned this Jun 15, 2024
@hburn7 hburn7 merged commit 82a066b into master Jun 19, 2024
3 checks passed
@hburn7 hburn7 deleted the hotfix/country-rank branch June 19, 2024 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:statistics bug Something isn't working size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix country rank 0 for all players
1 participant