From c1a73c49d39439284daab3c348687aa905fbdaef Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Sat, 25 Jan 2020 20:20:06 +0100
Subject: [PATCH] Fix some smart plan features

---
 .../templates/chronos/partials/lesson.html       | 16 +++++++---------
 .../chronos/templates/chronos/substitutions.html |  2 +-
 aleksis/apps/chronos/views.py                    |  1 +
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/aleksis/apps/chronos/templates/chronos/partials/lesson.html b/aleksis/apps/chronos/templates/chronos/partials/lesson.html
index b6b2ae96..8dc4f9fb 100644
--- a/aleksis/apps/chronos/templates/chronos/partials/lesson.html
+++ b/aleksis/apps/chronos/templates/chronos/partials/lesson.html
@@ -7,15 +7,13 @@
     {% for lesson_period in lessons %}
       <div style="
               {# Display background color only if no badge exists and it is not the old room and there are no holidays #}
-              {% if not lesson_period.substitution.table.badge %}
-                {% if not lesson_period.is_old or type != 1 %}
-                  {% if not lesson_period.is_hol %}
-                    {% if lesson_period.lesson.subject.colour_fg %}
-                      color: {{ lesson_period.lesson.subject.colour_fg }};
-                    {% endif %}
-                    {% if lesson_period.lesson.subject.colour_bg %}
-                      background-color: {{ lesson_period.lesson.subject.colour_bg }};
-                    {% endif %}
+              {% if not lesson_period.get_substitution.cancelled and not lesson_period.is_hol %}
+                {% if not lesson_period.room != lesson_period.get_room or type != 1 %}
+                  {% if lesson_period.lesson.subject.colour_fg %}
+                    color: {{ lesson_period.lesson.subject.colour_fg }};
+                  {% endif %}
+                  {% if lesson_period.lesson.subject.colour_bg %}
+                    background-color: {{ lesson_period.lesson.subject.colour_bg }};
                   {% endif %}
                 {% endif %}
               {% endif %}
diff --git a/aleksis/apps/chronos/templates/chronos/substitutions.html b/aleksis/apps/chronos/templates/chronos/substitutions.html
index a195696d..e2dae3c1 100644
--- a/aleksis/apps/chronos/templates/chronos/substitutions.html
+++ b/aleksis/apps/chronos/templates/chronos/substitutions.html
@@ -100,7 +100,7 @@
             {# TODO: Support other cases#}
             <span class="badge new green hide-on-med-and-up">{% trans "Cancelled" %}</span>
           {% endif %}
-          <em>{{ sub.text|default:"" }}</em>
+{#          <em>{{ sub.text|default:"" }}</em>#}
         </td>
         <td class="hide-on-small-and-down">
           {% if sub.cancelled %}
diff --git a/aleksis/apps/chronos/views.py b/aleksis/apps/chronos/views.py
index fd26e5e6..90cac912 100644
--- a/aleksis/apps/chronos/views.py
+++ b/aleksis/apps/chronos/views.py
@@ -101,6 +101,7 @@ def my_timetable(
     context["type"] = type_
     context["day"] = wanted_day
     context["periods"] = TimePeriod.get_times_dict()
+    context["smart"] = True
 
     context["url_prev"], context["url_next"] = get_prev_next_by_day(
         wanted_day, "my_timetable_by_date"
-- 
GitLab