ranked_in_list is not sorted by rank #29

Closed
agerlic opened this Issue Oct 21, 2012 · 1 comment

Comments

Projects
None yet
2 participants

agerlic commented Oct 21, 2012

ranked_in_list is not sorted by rank:

eg (with 2.5.0):

HIGHSCORE_LB.rank_member("id1", 200)
HIGHSCORE_LB.rank_member("id2", 100)
HIGHSCORE_LB.rank_member("id3", 300)
HIGHSCORE_LB.ranked_in_list(["id1", "id2", "id3"])
=> [{:member=>"id1", :rank=>2, :score=>200.0}, {:member=>"id2", :rank=>3, :score=>100.0}, {:member=>"id3", :rank=>1, :score=>300.0}]

Member

czarneckid commented Oct 21, 2012

This has been the behavior of that method from the beginning as it was intended to be used to retrieve an arbitrary list of members from the leaderboard in no particular order. I can clarify that as the behavior in the code and in the README.

I may look at modifying the behavior to return the list, sorted by rank, in version 3 of the library.

@czarneckid czarneckid closed this Oct 21, 2012

czarneckid pushed a commit that referenced this issue Oct 21, 2012

Version 3 proposal: Add a `:sort_by` option
As indicated in #29, the currently undocumented behavior of a
direct call to `ranked_in_list` is to do no sorting on the results.
The call was originally intended to be used to retrieve a list
of friends from a leaderboard. However, it would be useful in
certain situations to have the results sorted. This adds a
`:sort_by` option to that would be appropriate for the
`ranked_in_list` call to sort by either score (`:score`) or
rank (`:rank`) when returning results.

czarneckid pushed a commit that referenced this issue Oct 21, 2012

Version 3 proposal: Add a `:sort_by` option
As indicated in #29, the currently undocumented behavior of a
direct call to `ranked_in_list` is to do no sorting on the results.
The call was originally intended to be used to retrieve a list
of friends from a leaderboard. However, it would be useful in
certain situations to have the results sorted. This adds a
`:sort_by` option to that would be appropriate for the
`ranked_in_list` call to sort by either score (`:score`) or
rank (`:rank`) when returning results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment