From 8d938443c92560d9bd91a974436641e724025e56 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt Date: Tue, 15 Sep 2020 16:50:12 -0400 Subject: Simplify the logic diff --git a/program/templates/week_schedule_timeslot.html b/program/templates/week_schedule_timeslot.html index 693f5f9..a8538a7 100644 --- a/program/templates/week_schedule_timeslot.html +++ b/program/templates/week_schedule_timeslot.html @@ -1,64 +1,56 @@ {% load timeslots %} -{% if forloop.first and timeslot.start != timeslot.get_previous_by_start.end %} -
-
{{ default_show.name }}
-
+{% if forloop.first %} + {% if timeslot.start|time:"Hi" <= "0600" or timeslot.end.hour < timeslot.start.hour %} + {# the show starts at or before 6 am or yesterday #} +
+
{{ timeslot.show.name }}
+
+ {% else %} + {# the show doesn´t start at or before 6 am -> default_show until the start of the show #} +
+
{{ default_show.name }}
+
+
+
{{ timeslot.show.name }}
+
+ {% endif %} {% endif %} -{% if forloop.first and timeslot.start != "06:00" and timeslot.show == default_show %} -
+{% if not forloop.first and not forloop.last %} + {% endif %} -{% if forloop.first and timeslot.start != "06:00" and timeslot.show != default_show %} - {% if timeslot.end.hour > timeslot.start.hour %} - +{% if forloop.last %} + {% if timeslot.end|time:"Hi" <= "0600" and timeslot.pk != 99678 %} + {% else %} - + {% endif %} {% endif %} -{% if not forloop.first and not forloop.last %} -
- {% if timeslot.show == default_show %} -
{{ default_show.name }}
- {% else %} -
{{ timeslot.show.name }}
- {% endif %} -
- {% if timeslot.end != timeslot.get_next_by_start.start %} -
+{% if timeslot.end < timeslot.get_next_by_start.start and timeslot.end|time:"Hi" != "0600" %} + {% if not forloop.last %} +
{{ default_show.name }}
- {% endif %} -{% endif %} - -{% if forloop.last and timeslot.end != "06:00" and timeslot.show == default_show %} -
-
{{ default_show.name }}
-
-{% endif %} - -{% if forloop.last and timeslot.end != "06:00" and timeslot.show != default_show %} - {% if timeslot.end.hour < timeslot.start.hour %} - {% else %} - +
+
{{ default_show.name }}
+
{% endif %} {% endif %} - -{% if forloop.last and timeslot.end != timeslot.get_next_by_start.start %} -
-
{{ default_show.name }}
-
-{% endif %} -- cgit v0.10.2