thewca / statistics

12 stars 16 forks source link

fix off-by-one issue with paging #97

Closed spencerchubb closed 1 year ago

spencerchubb commented 1 year ago

This pull request only changes one line.

It also addresses issue https://github.com/thewca/statistics/issues/87 which was opened a year ago.

The issue arises if you try to get a user who is an exact multiple of 20 (note that 20 is the page size). For example, the 100th user should get page 81-100, but instead gets 101-120

For example, look at the sum of ranks page and enter 2011SBAH01. He should be the 100th user, but instead it shows #101-120

campos20 commented 1 year ago

I don't think that this solves the issue as it changes the behavior for all the cases, including the one that is currently working. Do you have some time do debug this issue? We can do a screen share.

spencerchubb commented 1 year ago

Yes I'll email you

campos20 commented 1 year ago

I still want to use the call with screen share (pretty much because I want to see how easy/not easy this project is for other people to run this, but I checked and the correct fix is to change this line to

floor((region_rank-1) / :PAGE_SIZE)