Minor cli.py refactoring.

This commit is contained in:
crudo 2017-03-24 19:39:05 +01:00
parent c771aaadbc
commit b93478ac85

10
cli.py
View File

@ -99,15 +99,15 @@ def tabulate_events(events):
def get_overlapping_events(session, starts_at, ends_at): def get_overlapping_events(session, starts_at, ends_at):
q = session.query(Event) events = session.query(Event)
if ends_at is None: if ends_at is None:
q = q.filter(Event.starts_at <= starts_at) events = events.filter(Event.starts_at <= starts_at)
else: else:
q = q.filter(Event.ends_at >= starts_at)\ events = events.filter(Event.ends_at >= starts_at)\
.filter(Event.starts_at <= ends_at) .filter(Event.starts_at <= ends_at)
return q.all() return events.all()
@event.command('add') @event.command('add')