Exemplo n.º 1
0
def get_bookings_by_booking_ref(booking_ref, company=None, active_only=False):
  q = Booking.all()
  q.filter('booking_ref = ', booking_ref)

  if company:
    q.filter('company = ', company)

  if active_only:
    q.filter("last_date >= ", _current_date() - _active_period)

  return [b.to_dict() for b in q]
Exemplo n.º 2
0
def get_bookings(active_only=True, states=['UNPAID', 'PAID', 'CREDIT']):
  res = {}
  now = _current_date()

  if not active_only and isinstance(states, list):
    states.append('CANCELLED')
  elif not isinstance(states, list):
    states = [states]

  for cat in states:
    q = Booking.all()
    q.filter("state = ", cat)
    if active_only:
      q.filter("last_date >= ", now - _active_period)

    res[cat] = [b.to_dict() for b in q]

  return res
Exemplo n.º 3
0
def get_current_courses():
  now = _current_date()
  q = Booking.all()
  q.filter("last_date >= ", now - _active_period)

  return set([b.course for b in q])