Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define top(number) helper method #50

Merged
merged 1 commit into from
Jan 23, 2015

Conversation

robertomiranda
Copy link
Contributor

I just wanted to add a shorthand for get top_10 of a specific leaderboard, but this cover a general way:

leaderboard.top_10
leaderboard.top_5

I'll add the test cases and proper document if this method fit with the library

@czarneckid
Copy link
Member

@robertomiranda After thinking about this a bit more, I think I'd rather see explicit .top(number) and .top_in(leaderboard_name, number) methods that would do the same thing. This will be helpful when I go to port the functionality over to the Python and JavaScript versions of the library.

@robertomiranda
Copy link
Contributor Author

@czarneckid make more sense 👍

@robertomiranda
Copy link
Contributor Author

@czarneckid done 😁

# @param options [Hash] Options to be used when retrieving the data from the leaderboard.
#
# @return number from the leaderboard that fall within the given rank range.
def top(number,options = {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a space here between the arguments?

@czarneckid
Copy link
Member

Looks good. Could you please round out the specs to cover the other leaderboard types (reverse option, Tie and Competition)?

@czarneckid
Copy link
Member

And if you wouldn't mind squashing the commits after you're all done, that'd be great. Thanks in advance.

@robertomiranda robertomiranda changed the title Define TopX helper method Define top(number) helper method Dec 9, 2014
@@ -197,6 +197,69 @@
end
end

it 'should allow you to retrieve a given set of members from the leaderboard in a rank range' do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@czarneckid I realized that in Tie Ranking type were missing the test case for members_from_rank_range. also do you think that this is ready for the commits squash?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ready for the commits squash. I think the only other spec to add would be for the Competition Ranking type.

Add `top(number)` method as a shorthand of `members_from_rank_range(1,number)

Add `top_in(leaderboard_name, number)` method as a shorthan of `members_from_rank_range_in(leaderboard_name, 1, number)`

Testing top methods for rever leadearboard type

Testing Againts to Tie Ranking Leaderboard

Testing Competition Ranking Leaderboard
@robertomiranda
Copy link
Contributor Author

@czarneckid done!

@czarneckid
Copy link
Member

I'll look at this more in-depth over the next few days, but otherwise things look great. I may add some more specs that add more tie scores to the tie and competition ranking leaderboard types.

@robertomiranda
Copy link
Contributor Author

@czarneckid any other suggestion?

@czarneckid
Copy link
Member

No. I've got some time over the next week to get this integrated. Sorry it's been awhile. End of year, holidays and getting back into the swing of things here at work.

@robertomiranda
Copy link
Contributor Author

sure np 👍, I was just wondering 😄

@czarneckid czarneckid merged commit af7d296 into agoragames:master Jan 23, 2015
@robertomiranda robertomiranda deleted the top-x branch January 24, 2015 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants