Skip to content

Conversation

@hburn7
Copy link
Contributor

@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
@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

2 participants