Minor cli.py refactoring.
This commit is contained in:
parent
c07c19ca32
commit
5db877dc4c
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