Can't you create an index on a "Bookings" entity based on time, so you
can do a query "SELECT * FROM Bookings WHERE time = 1PM" ?  If you can
keep the list of courts in memcache, it should be easy to compare this
list to the list of courts to find open listings at any given time.
With an index, you shouldn't have to worry about the 1000-item limit
unless you envision having more than 1000 reservations for a given
time.

If you let people reserve intervals, rather than discrete slots, it
gets harder, since you can't do a query for "WHERE start_time < 1PM
AND end_time > 1:30PM".  You can probably work around this either by
getting all the bookings for a day (less scalable) or by using a "This
booking reserves the 1-1:15 slot and the 1:15-1:30 slot" design so you
can still easily search for when a court is free.

This doesn't protect against double-booking; you'll have to be
paranoid in client code about that.

On Nov 5, 4:09 pm, "Ian Bambury" <[EMAIL PROTECTED]> wrote:
> I think this is the last question I need answered in order to see if GAE can
> do what I need.
>
> Imagine a database of sports clubs all of which have customers for tennis
> courts
>
> My idea is that I have
>
> Club
> Customer
> Booking
> Court
>
> where a booking has a reference to the court and the customer and the club,
> and also holds the date and time of the booking (just the hour to make
> things simple, and we'll assume all bookings are an hour long)
>
> Two things:
>
> a) Is this evil 'old' thinking and I should be doing something else?
>
> b) If not, then how would I find out if there were a free tennis court
> somewhere in any of the clubs at a certain time and on a certain date?
>
> It's easy enough to find existing bookings on that day and at that time, but
> how do I find a court without a booking?
>
> I believe it is not possible to retrieve all the courts and get rid of the
> ones with bookings because there will be more than 1000 courts in the
> system.
>
> Can anyone help me out please?
>
> Thanks
> Ian
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to