Minor cli.py refactoring.
This commit is contained in:
parent
c771aaadbc
commit
b93478ac85
10
cli.py
10
cli.py
|
@ -99,15 +99,15 @@ def tabulate_events(events):
|
|||
|
||||
|
||||
def get_overlapping_events(session, starts_at, ends_at):
|
||||
q = session.query(Event)
|
||||
events = session.query(Event)
|
||||
|
||||
if ends_at is None:
|
||||
q = q.filter(Event.starts_at <= starts_at)
|
||||
events = events.filter(Event.starts_at <= starts_at)
|
||||
else:
|
||||
q = q.filter(Event.ends_at >= starts_at)\
|
||||
.filter(Event.starts_at <= ends_at)
|
||||
events = events.filter(Event.ends_at >= starts_at)\
|
||||
.filter(Event.starts_at <= ends_at)
|
||||
|
||||
return q.all()
|
||||
return events.all()
|
||||
|
||||
|
||||
@event.command('add')
|
||||
|
|
Loading…
Reference in New Issue
Block a user