diff options
author | Ernesto Rico Schmidt <e.rico.schmidt@gmail.com> | 2020-01-24 03:53:48 (GMT) |
---|---|---|
committer | Ernesto Rico Schmidt <e.rico.schmidt@gmail.com> | 2020-01-24 03:53:48 (GMT) |
commit | 639996ffeb25c4a48f47067b0613ec0925a1054b (patch) | |
tree | b9ed18ee70429ce005f85b7b75de0761ec532cd5 /program/templatetags | |
parent | 4392d193a96dae6a0efb2e22b42a8c55b3e7707f (diff) |
more height to display the 5 min slot at 12 pm beginning next week
Diffstat (limited to 'program/templatetags')
-rw-r--r-- | program/templatetags/timeslots.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/program/templatetags/timeslots.py b/program/templatetags/timeslots.py index 08e45b1..9b6712a 100644 --- a/program/templatetags/timeslots.py +++ b/program/templatetags/timeslots.py @@ -6,20 +6,23 @@ register = template.Library() @register.simple_tag -def duration(start, end): - return 'style="height: %dpx"' % ((end-start).seconds/60) +def height(start, end): + if start.year == 2020 and int(start.strftime('%V')) >= 5 and start.hour == 12 and start.minute == 0: + return '30' + else: + return '%d' % ((end - start).seconds / 60) @register.simple_tag -def duration_until(end): +def height_until(end): start = datetime.combine(end.date(), time(6, 0)) - return 'style="height: %dpx"' % ((end-start).seconds/60) + return '%d' % ((end - start).seconds / 60) @register.simple_tag -def duration_since(start): +def height_since(start): if start.time() < time(23, 59): - end = datetime.combine(start.date()+timedelta(days=1), time(6, 0)) + end = datetime.combine(start.date() + timedelta(days=1), time(6, 0)) else: end = datetime.combine(start.date(), time(6, 0)) - return 'style="height: %dpx"' % ((end-start).seconds/60) + return '%d' % ((end - start).seconds / 60) |