jonatanklosko / wca_statistics

Build kit for generating cubing-related rankings
https://jonatanklosko.github.io/wca_statistics
MIT License
18 stars 29 forks source link

Round instead of truncating for average_of_x stats to match WCA #27

Closed JustinTimeCuber closed 5 months ago

JustinTimeCuber commented 5 months ago

The average_of_x statistics use the to_i method to round the average, which results in truncation, for example: image Here the counting times are 4.81, 4.50, and 5.20, which average to 4.836667.

For comparison, the WCA uses rounding for calculation of official averages, for example, see the WR average: image 4.72, 4.72, and 3.99 average to 4.476667, but the WCA rounds this to 4.48.

I fixed this by replacing to_i with round in the average function.

(P.S. thanks to Keon Wilson for noticing this issue)