Esempio n. 1
0
def get_events(day):
    events = None
    if type(day) == list:
        # assuming this is a list of days
        return Event.gql("WHERE date >= :1 and date <= :2 ORDER BY date, time ASC", day[0], day[-1]).fetch(1000)

    events = Event.gql("WHERE date = :1 ORDER BY time ASC", day).fetch(1000)
    # put events with no time defined at the end
    eventslist = []
    events_notime = []
    for event in events:
        if event.time:
            eventslist.append(event)
        else :
            events_notime.append(event)
    return eventslist + events_notime
Esempio n. 2
0
def get_reminders(day):
    dayname = day.strftime("%A").lower()
    reminders = Event.gql("WHERE dayend >= :1 AND %s = :2" % dayname,
                          day, True).fetch(1000)
    time = []
    notime = []
    for r in reminders:
        if r.date >= day:
            continue
        if r.time:
            time.append(r)
        else:
            notime.append(r)
    time.sort(key=lambda r: r.time)
    return time + notime
Esempio n. 3
0
def get_venue_events(days, venue_key):
    events = Event.gql("WHERE date >= :1 and date <= :2 and venue = :3 ORDER BY date, time DESC",
                       days[0], days[-1], venue_key).fetch(1000)
    return [add_daydiff_attribute(event, days[0]) for event in events]    
Esempio n. 4
0
def get_highlights(days):
    events = Event.gql("WHERE date >= :1 AND date <= :2 AND highlight = :3 ORDER BY date ASC, time ASC", days[0], days[-1], True).fetch(1000)
    return [add_daydiff_attribute(event, days[0]) for event in events]