agoragames / leaderboard

Leaderboards backed by Redis in Ruby
https://rubygems.org/gems/leaderboard
MIT License
480 stars 65 forks source link

Maybe paging behavior is a little confusing? #69

Open xofred opened 5 years ago

xofred commented 5 years ago

Let's say we have a leaderboard with 2 pages, leaders(3) will return page 2 contents, which is confusing.

https://github.com/agoragames/leaderboard/blob/master/lib/leaderboard.rb#L714

if current_page > total_pages_in(leaderboard_name, page_size)
  current_page = total_pages_in(leaderboard_name, page_size)
end

I think, if something are not exist, should return empty array, like kaminari or other APIs design.

If it's design on purpose, maybe README should make this behavior clearly.

ps: Love your games since Facebook and Flash age. Thank you guys for the great works! And pardon my poor English.