Skip to content
Snippets Groups Projects
Commit 91cc1fdf authored by David Trattnig's avatar David Trattnig
Browse files

Query for upcoming schedules.

parent f674f94d
No related branches found
No related tags found
No related merge requests found
......@@ -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):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment