Hi Josh,

Seems like you can use the technique in the linked document, but
replace order("-when") with order("-score"), so I guess the real issue
is how to display the rank (I assume you mean first place, second
place, etc.).  If displaying pages of players, I think you can just
use a counter (in Python code, not the data store) that increments
with each displayed name.

I guess the real challenge is, when talking to a specific player, how
do you tell them that they are ranked 50000th.  I'm pretty new to GAE,
but I'd probably use a query that selected records that were less than
the current user's score, and then get the count (ignoring ties).

http://code.google.com/appengine/docs/python/datastore/queryclass.html#Query_count


On Oct 2, 5:40 pm, Josh <[email protected]> wrote:
> Hi all,
>
> I've seen a number of interesting discussions on how to do efficient
> pagination on appengine, but one thing that I haven't seen addressed,
> which I would like, is how to efficiently compute ranking information
> for the items that are paginated.
>
> Let me motivate this discussion by considering a leader board.  We
> have a model like so:
>
> class Player(db.Model):
>   name = db.StringProperty()
>   score = db.IntegerProperty()
>   last_updated = db.DateTimeProperty(auto_now=True)
>
> We may have hundreds of thousands of Players and we want to be able to
> rank them by their score.
>
> How could we used the previously discussed pagination techniques
> (http://code.google.com/appengine/articles/paging.html) to efficiently
> page through the leader board and not only show the Players in order
> by score, but also assign a rank value to each player.
>
> Many thanks for your thoughts and input.
>
> Cheers,
> Josh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to