Commit 91cc1fdf authored by David Trattnig's avatar David Trattnig
Browse files

Query for upcoming schedules.

parent f674f94d
......@@ -180,6 +180,20 @@ class Schedule(DB.Model, AuraDatabaseModel):
return all_entries
@staticmethod
def select_upcoming(n):
"""
Selects the (`n`) upcoming schedules.
"""
now = datetime.datetime.now()
DB.session.commit() # Required since independend session is used.
schedules = DB.session.query(Schedule).\
filter(Schedule.schedule_start > str(now)).\
order_by(Schedule.schedule_start.asc()).limit(n).all()
return schedules
@hybrid_property
def start_unix(self):
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment