osuAkatsuki / bancho.py

An osu! server for the generic public, optimized for maintainability in modern python
https://akatsuki.gg
MIT License
213 stars 128 forks source link

fix: Address inconsistent BEST submission status evaluation through DB rounding #572

Closed minisbett closed 7 months ago

minisbett commented 7 months ago

Describe your changes

When submitting a play, the self.pp > rec["pp"] check for evaluating the submission status of a score in score.py calculate_status() has inconsistent behavior, since the self.pp variable contains as much decimal precision as the PP calculator gives, while the rec["pp"] value is straight from the database, which has 3 maximum decimals.

If a score with the exact same PP as the current best is submitted, in some cases this means the equation results in 0.9995 > 1.000, which is false, sometimes 1.0001 > 1.000, which is true. Depending on the score this means that a 1:1 same score would overwrite the last one, or not. This might be confusing for the playtime of scores in topplays.

Below are two obversations of the two scenarios

The earlier score is considered best because the actual decimal accurate PP is < the 3-decimal rounded database value image

The latter score is considered best because the actuald ecimal accurate PP is > the 3-decimal rounded database value image

Checklist

In testing on kokisu