calendar: cleaner code and better hide
This commit is contained in:
parent
c3c837b7f4
commit
6495c625b4
1 changed files with 11 additions and 7 deletions
|
@ -71,13 +71,17 @@ def events_calendar():
|
||||||
actions = tuple(model.get_actions_by_alarm(alarm))
|
actions = tuple(model.get_actions_by_alarm(alarm))
|
||||||
if not actions:
|
if not actions:
|
||||||
continue
|
continue
|
||||||
t = datetime.fromtimestamp(int(today.strftime("%s")))
|
today_dt = datetime.fromtimestamp(int(today.strftime("%s")))
|
||||||
occurrences = [
|
max_dt = datetime.combine(today_dt + timedelta(days=max_days), time())
|
||||||
t
|
occurrences = []
|
||||||
for t in timegenerate(alarm, now=t, howmany=max_occurrences + 1)
|
for t in timegenerate(
|
||||||
if t is not None
|
alarm, now=today_dt, howmany=max_occurrences + 1
|
||||||
and t <= datetime.combine(today + timedelta(days=max_days), time())
|
):
|
||||||
]
|
if t is None:
|
||||||
|
break
|
||||||
|
if t > max_dt:
|
||||||
|
break
|
||||||
|
occurrences.append(t)
|
||||||
if not occurrences:
|
if not occurrences:
|
||||||
continue
|
continue
|
||||||
if not show_all and len(occurrences) > max_occurrences:
|
if not show_all and len(occurrences) > max_occurrences:
|
||||||
|
|
Loading…
Reference in a new issue