Here's a generic example of one of my use cases - I'm curious if
anyone has any ideas I haven't thought of...

Let's say I have an app where users can buy tickets to a raffle (I'm
not really creating a gambling app, this is just an example).  There
are two types of tickets - purchased tickets and free tickets (given
away as promotions).  There may be more than 1000 users with tickets
to a particular raffle, but each user is unlikely to have more than
1000 tickets to a particular raffle.  When a raffle ends, a winning
ticket is selected from the tickets for that raffle...but here's the
hard part:  I would like to be able to refund, based on some logic,
some or all of each user's purchased tickets for that raffle if they
don't win.  For example:  User A has 10 purchased tickets and 10 free
tickets for a raffle.  He has 5 tickets remaining on his account.  He
doesn't win the raffle.  Because his User.level == 2, he gets refunded
10 tickets.  User B has the same situation, but has User.level == 3.
He gets refunded all his free tickets plus 50% of his purchased
tickets.

Here's my current setup:

Class User (db.Model):
  level = db.IntegerProperty
  paidtickets = db.IntegerProperty
  freetickets = db.IntegerProperty

Class Ticket (db.Model):
  user = db.ReferenceProperty
  type = db.BooleanProperty (true=paid, false=free)
  (parent = Raffle)

Class Raffle (db.Model)
  expires = db.DateTimeProperty
  winner = db.ReferenceProperty

My problem is I need to be able to determine: a.) which users had
tickets to a particular auction, b.) how many tickets (of each type)
they had for the auction.  Then I need to update all those (possible
more than 1000) users to reflect the refund.  What is the best way to
do this without maxing out datastore cpu and query limits?
ListProperties updated every time a ticket is added?  How do I get
around the 1000-entity limit?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to