From 783167756ef83f6e95e4e854e18d772d6b2f8c20 Mon Sep 17 00:00:00 2001
From: Tom Teichler <tom.teichler@teckids.org>
Date: Wed, 17 Jul 2019 12:03:57 +0200
Subject: [PATCH 01/22] Add gitignore and tt_lesson snippet. Advances #01.

---
 .gitignore                                    | 52 +++++++++++++++++++
 .../chronos/templates/chronos/tt_lesson.html  | 11 ++++
 2 files changed, 63 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 biscuit/apps/chronos/templates/chronos/tt_lesson.html

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..c9a6fd37
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,52 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+
+# pyenv
+.python-version
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+
+# Editors
+*~
+DEADJOE
+\#*#
+
+# Database
+db.sqlite3
diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
new file mode 100644
index 00000000..46bd3821
--- /dev/null
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -0,0 +1,11 @@
+<div class="card" style="width: 18rem; {{% if Lesson.color-fg %}} foreground-color: {{ Lesson.color-fg }}; {% endif%} {{% if Lesson.color-bg %}} background-color: {{% Lesosn.color-bg %}};">
+  <div class="card-body">
+    <h5 class="card-title">{{ Lesson.subject.abbrev }}</h5>
+    <h6 class="">Rooms {# Will be implemented soon#}</h6>
+    <ul>
+     <li>{{ Lesson.teachers }}</li>
+     <li>{{ Lesson.groups }}</li>
+    </ul>
+    <a href="{{% '#' %}}" class="card-link">Room informations</a>
+  </div>
+</div>
-- 
GitLab


From b0d1b82b3cf4db9b9ce32158083cd72f0d1f9ea2 Mon Sep 17 00:00:00 2001
From: Tom Teichler <tom.teichler@teckids.org>
Date: Wed, 17 Jul 2019 12:03:57 +0200
Subject: [PATCH 02/22] Add gitignore and tt_lesson snippet. Advances #01.

---
 .gitignore                                    | 52 +++++++++++++++++++
 .../chronos/templates/chronos/tt_lesson.html  | 11 ++++
 2 files changed, 63 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 biscuit/apps/chronos/templates/chronos/tt_lesson.html

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..c9a6fd37
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,52 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+
+# pyenv
+.python-version
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+
+# Editors
+*~
+DEADJOE
+\#*#
+
+# Database
+db.sqlite3
diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
new file mode 100644
index 00000000..84f222a3
--- /dev/null
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -0,0 +1,11 @@
+<div class="card" style="width: 18rem; {{% if Lesson.color-fg %}} foreground-color: {{ Lesson.color-fg }}; {% endif%} {{% if Lesson.color-bg %}} background-color: {{% Lesson.color-bg %}};">
+  <div class="card-body">
+    <h5 class="card-title">{{ Lesson.subject.abbrev }}</h5>
+    <h6 class="">Rooms {# Will be implemented soon#}</h6>
+    <ul>
+     <li>{{ Lesson.teachers }}</li>
+     <li>{{ Lesson.groups }}</li>
+    </ul>
+    <a href="{{% '#' %}}" class="card-link">Room informations</a>
+  </div>
+</div>
-- 
GitLab


From f9f0431270398051c5193ab2a172c9b0943cbcef Mon Sep 17 00:00:00 2001
From: Tom Teichler <tom.teichler@teckids.org>
Date: Wed, 17 Jul 2019 13:17:57 +0200
Subject: [PATCH 03/22] Add initial tt_week.html.

---
 biscuit/apps/chronos/templates/chronos/tt_week.html | 8 ++++++++
 biscuit/apps/chronos/views.py                       | 6 ++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
 create mode 100644 biscuit/apps/chronos/templates/chronos/tt_week.html

diff --git a/biscuit/apps/chronos/templates/chronos/tt_week.html b/biscuit/apps/chronos/templates/chronos/tt_week.html
new file mode 100644
index 00000000..191c0dde
--- /dev/null
+++ b/biscuit/apps/chronos/templates/chronos/tt_week.html
@@ -0,0 +1,8 @@
+{# -*- engine:django -*- #}
+{% extends "core/base.html" %}
+{% load bootstrap4 %}
+
+{% block page_title %}Timetable{% endblock %}
+
+{% block content %}
+{% endblock %}
diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py
index 43e81eb3..4e050cd6 100644
--- a/biscuit/apps/chronos/views.py
+++ b/biscuit/apps/chronos/views.py
@@ -1,9 +1,11 @@
 from django.contrib.auth.decorators import login_required
+from django.shortcuts import redirect, render
 
 from biscuit.core.decorators import admin_required
 
-
 @login_required
 @admin_required
 def timetable(request):
-    pass
+    context = {}
+
+    return render(request, 'chronos/tt_week.html')
-- 
GitLab


From 8e468fda2953a72d73244db688885acea25f9d3f Mon Sep 17 00:00:00 2001
From: Tom Teichler <tom.teichler@teckids.org>
Date: Wed, 17 Jul 2019 14:46:43 +0200
Subject: [PATCH 04/22] Fix typo.

---
 biscuit/apps/chronos/templates/chronos/tt_lesson.html | 8 ++++----
 biscuit/apps/chronos/templates/chronos/tt_week.html   | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index 84f222a3..a909bffd 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -1,10 +1,10 @@
-<div class="card" style="width: 18rem; {{% if Lesson.color-fg %}} foreground-color: {{ Lesson.color-fg }}; {% endif%} {{% if Lesson.color-bg %}} background-color: {{% Lesson.color-bg %}};">
+<div class="card" style="width: 18rem; {{% if lesson.color-fg %}} foreground-color: {{ lesson.color-fg }}; {% endif%} {{% if lesson.color-bg %}} background-color: {{% lesson.color-bg %}};">
   <div class="card-body">
-    <h5 class="card-title">{{ Lesson.subject.abbrev }}</h5>
+    <h5 class="card-title">{{ lesson.subject.abbrev }}</h5>
     <h6 class="">Rooms {# Will be implemented soon#}</h6>
     <ul>
-     <li>{{ Lesson.teachers }}</li>
-     <li>{{ Lesson.groups }}</li>
+     <li>{{ lesson.teachers }}</li>
+     <li>{{ lesson.groups }}</li>
     </ul>
     <a href="{{% '#' %}}" class="card-link">Room informations</a>
   </div>
diff --git a/biscuit/apps/chronos/templates/chronos/tt_week.html b/biscuit/apps/chronos/templates/chronos/tt_week.html
index 191c0dde..58af9cd2 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_week.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_week.html
@@ -5,4 +5,6 @@
 {% block page_title %}Timetable{% endblock %}
 
 {% block content %}
+{% include "chronos/tt_lesson.html" %}
+
 {% endblock %}
-- 
GitLab


From f10071d2559b29a67ed95e29d602f5c6b391232b Mon Sep 17 00:00:00 2001
From: Martin Gummi <martin.gummi@teckids.org>
Date: Wed, 17 Jul 2019 16:05:40 +0200
Subject: [PATCH 05/22] Fix tt_lesson

---
 biscuit/apps/chronos/templates/chronos/tt_lesson.html | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index a909bffd..cbcd783d 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -1,11 +1,11 @@
-<div class="card" style="width: 18rem; {{% if lesson.color-fg %}} foreground-color: {{ lesson.color-fg }}; {% endif%} {{% if lesson.color-bg %}} background-color: {{% lesson.color-bg %}};">
+<div class="card" style="width: 18rem; {% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
   <div class="card-body">
     <h5 class="card-title">{{ lesson.subject.abbrev }}</h5>
-    <h6 class="">Rooms {# Will be implemented soon#}</h6>
+    <h6 class="card-text">Rooms {# Will be implemented soon#}</h6>
     <ul>
      <li>{{ lesson.teachers }}</li>
      <li>{{ lesson.groups }}</li>
     </ul>
-    <a href="{{% '#' %}}" class="card-link">Room informations</a>
+    <a href="#" class="card-link">Room informations</a>
   </div>
 </div>
-- 
GitLab


From 84baa764fcc3dcad28b06486768ab337359821f5 Mon Sep 17 00:00:00 2001
From: Martin Gummi <martin.gummi@teckids.org>
Date: Wed, 17 Jul 2019 17:29:13 +0200
Subject: [PATCH 06/22] Add Dummy data.

---
 biscuit/apps/chronos/templates/chronos/tt_lesson.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index cbcd783d..9ebb7fa4 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -3,8 +3,8 @@
     <h5 class="card-title">{{ lesson.subject.abbrev }}</h5>
     <h6 class="card-text">Rooms {# Will be implemented soon#}</h6>
     <ul>
-     <li>{{ lesson.teachers }}</li>
-     <li>{{ lesson.groups }}</li>
+     <li>!lesson.teachers{{ lesson.teachers }}</li>
+     <li>!lesson.groups{{ lesson.groups }}</li>
     </ul>
     <a href="#" class="card-link">Room informations</a>
   </div>
-- 
GitLab


From 9bcf96a8bd29ccefb544eaa584ed74a62d1ed0be Mon Sep 17 00:00:00 2001
From: Martin Gummi <martin.gummi@teckids.org>
Date: Wed, 17 Jul 2019 17:31:11 +0200
Subject: [PATCH 07/22] Add initial tt_day.html.

---
 .../chronos/templates/chronos/tt_day.html     | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 biscuit/apps/chronos/templates/chronos/tt_day.html

diff --git a/biscuit/apps/chronos/templates/chronos/tt_day.html b/biscuit/apps/chronos/templates/chronos/tt_day.html
new file mode 100644
index 00000000..ced9b487
--- /dev/null
+++ b/biscuit/apps/chronos/templates/chronos/tt_day.html
@@ -0,0 +1,30 @@
+<div class="float-left">
+    <ul class="list-group">
+    <li class="list-group-item active" data-toggle="collapse" href="#collapseDay">Day</li>
+    </ul>
+    <div class="collapse" id="collapseDay">
+        <ul class="list-group">
+        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
+        </ul>
+        <ul class="list-group">
+        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
+        </ul>
+        <ul class="list-group">
+        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
+        </ul>
+        <ul class="list-group">
+        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
+        </ul>
+        <ul class="list-group">
+        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
+        </ul>
+        <ul class="list-group">
+        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
+        </ul>
+        <ul class="list-group">
+        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
+        </ul>
+    </div>
+</div>
+
+
-- 
GitLab


From 731533f9db11066466ee6f166bfee7408f8f97b8 Mon Sep 17 00:00:00 2001
From: Martin Gummi <martin.gummi@teckids.org>
Date: Wed, 17 Jul 2019 17:34:41 +0200
Subject: [PATCH 08/22] Add include tt_day.html.

---
 biscuit/apps/chronos/templates/chronos/tt_week.html | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_week.html b/biscuit/apps/chronos/templates/chronos/tt_week.html
index 58af9cd2..f9f9a563 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_week.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_week.html
@@ -5,6 +5,5 @@
 {% block page_title %}Timetable{% endblock %}
 
 {% block content %}
-{% include "chronos/tt_lesson.html" %}
-
+{% include "chronos/tt_day.html" %}
 {% endblock %}
-- 
GitLab


From 350ab530f0fd3d77e6f1257c734249b9b3d78614 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Wed, 17 Jul 2019 23:36:23 +0200
Subject: [PATCH 09/22] Use bootstrap grid for lesson card.

---
 .../chronos/templates/chronos/tt_lesson.html  | 30 ++++++++++++++-----
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index 9ebb7fa4..7d27b6e7 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -1,11 +1,25 @@
 <div class="card" style="width: 18rem; {% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
-  <div class="card-body">
-    <h5 class="card-title">{{ lesson.subject.abbrev }}</h5>
-    <h6 class="card-text">Rooms {# Will be implemented soon#}</h6>
-    <ul>
-     <li>!lesson.teachers{{ lesson.teachers }}</li>
-     <li>!lesson.groups{{ lesson.groups }}</li>
-    </ul>
-    <a href="#" class="card-link">Room informations</a>
+ <div class="card-body">
+  <div class="row">
+   <div class="col-sm">
+    <span class="card-title">{{ lesson.subject.abbrev }}</span>
+   </div>
   </div>
+  <div class="row">
+   <div class="col-sm">
+    {% for group in lesosn.groups %}
+     <span class="card-text">{{ group.short_name }}</span>
+    {% endfor %}
+   </div>
+   <div class="col-sm">
+    {% for teacher in lesosn.teachers %}
+     <span class="card-text">{{ teacher.short_name }}</span>
+    {% endfor %}
+   </div>
+   <div class="col-sm">
+    {# FIXME really add room information #}
+    <span class="card-text">Room</span>
+   </div>
+  </div>
+ </div>
 </div>
-- 
GitLab


From a7736b73e49365e48a62c1f628bf010b8016fb92 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Wed, 17 Jul 2019 23:48:38 +0200
Subject: [PATCH 10/22] Use bootstrap grid for day column and complete include
 logic.

---
 .../chronos/templates/chronos/tt_day.html     | 40 ++++++-------------
 1 file changed, 13 insertions(+), 27 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_day.html b/biscuit/apps/chronos/templates/chronos/tt_day.html
index ced9b487..3a3f4d65 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_day.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_day.html
@@ -1,30 +1,16 @@
 <div class="float-left">
-    <ul class="list-group">
-    <li class="list-group-item active" data-toggle="collapse" href="#collapseDay">Day</li>
-    </ul>
-    <div class="collapse" id="collapseDay">
-        <ul class="list-group">
-        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
-        </ul>
-        <ul class="list-group">
-        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
-        </ul>
-        <ul class="list-group">
-        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
-        </ul>
-        <ul class="list-group">
-        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
-        </ul>
-        <ul class="list-group">
-        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
-        </ul>
-        <ul class="list-group">
-        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
-        </ul>
-        <ul class="list-group">
-        <li class="list-group-item">{% include "chronos/tt_lesson.html" %}</li>
-        </ul>
+ <ul class="list-group">
+  <li class="list-group-item active">
+   {{ lesson_periods.0.period.get_weekday_display }}
+  </li>
+ </ul>
+ <div class="container">
+  {% for lesson_period in lesson_periods %}
+   <div class="row">
+    <div class="col-sm">
+     {% include "chronos/tt_lesson.html" with lesson=lesson_period.lesson %}
     </div>
+   </div>
+  {% endfor %}
+ </div>
 </div>
-
-
-- 
GitLab


From 9ee873984f3771a449837959bb9eefcb190b63cd Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Wed, 17 Jul 2019 23:50:01 +0200
Subject: [PATCH 11/22] Fix style.

---
 biscuit/apps/chronos/views.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py
index 4e050cd6..3f2001b7 100644
--- a/biscuit/apps/chronos/views.py
+++ b/biscuit/apps/chronos/views.py
@@ -1,11 +1,12 @@
 from django.contrib.auth.decorators import login_required
-from django.shortcuts import redirect, render
+from django.shortcuts import render
 
 from biscuit.core.decorators import admin_required
 
+
 @login_required
 @admin_required
 def timetable(request):
     context = {}
 
-    return render(request, 'chronos/tt_week.html')
+    return render(request, 'chronos/tt_week.html', context)
-- 
GitLab


From 75facb7a4b5e12117b34bae62c4b1fad2006823c Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Wed, 17 Jul 2019 23:51:54 +0200
Subject: [PATCH 12/22] Implement room display.

---
 biscuit/apps/chronos/templates/chronos/tt_day.html    | 2 +-
 biscuit/apps/chronos/templates/chronos/tt_lesson.html | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_day.html b/biscuit/apps/chronos/templates/chronos/tt_day.html
index 3a3f4d65..4e37be64 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_day.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_day.html
@@ -8,7 +8,7 @@
   {% for lesson_period in lesson_periods %}
    <div class="row">
     <div class="col-sm">
-     {% include "chronos/tt_lesson.html" with lesson=lesson_period.lesson %}
+     {% include "chronos/tt_lesson.html" with lesson_period=lesson_period %}
     </div>
    </div>
   {% endfor %}
diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index 7d27b6e7..c4a21a59 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -2,23 +2,22 @@
  <div class="card-body">
   <div class="row">
    <div class="col-sm">
-    <span class="card-title">{{ lesson.subject.abbrev }}</span>
+    <span class="card-title">{{ lesson_period.lesson.subject.abbrev }}</span>
    </div>
   </div>
   <div class="row">
    <div class="col-sm">
-    {% for group in lesosn.groups %}
+    {% for group in lesson_period.lesosn.groups %}
      <span class="card-text">{{ group.short_name }}</span>
     {% endfor %}
    </div>
    <div class="col-sm">
-    {% for teacher in lesosn.teachers %}
+    {% for teacher in lesson_period.lesosn.teachers %}
      <span class="card-text">{{ teacher.short_name }}</span>
     {% endfor %}
    </div>
    <div class="col-sm">
-    {# FIXME really add room information #}
-    <span class="card-text">Room</span>
+    <span class="card-text">{{ lesson_period.room.short_name }}</span>
    </div>
   </div>
  </div>
-- 
GitLab


From 13f250c0908fd0d67c0c3a5c44fb84e54b14724a Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:02:58 +0200
Subject: [PATCH 13/22] Pass lesson periods to tempalte, sorted by day.

---
 biscuit/apps/chronos/views.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py
index 3f2001b7..09b0be2f 100644
--- a/biscuit/apps/chronos/views.py
+++ b/biscuit/apps/chronos/views.py
@@ -3,10 +3,31 @@ from django.shortcuts import render
 
 from biscuit.core.decorators import admin_required
 
+from .models import LessonPeriod
+
 
 @login_required
 @admin_required
 def timetable(request):
     context = {}
 
+    lesson_periods = LessonPeriod.objects.all()
+
+    if 'group' in request.GET:
+        lesson_periods = lesson_periods.filter(
+            lesson__groups__pk__contains=int(request.GET('group')))
+    if 'teacher' in request.GET:
+        lesson_periods = lesson_periods.filter(
+            lesson__teachers__pk__contains=int(request.GET('teacher')))
+    if 'room' in request.GET:
+        lesson_periods = lesson_periods.filter(
+            room__pk=int(request.GET('room')))
+
+    per_day = {}
+    for lesson_period in lesson_periods:
+        for period in lesson_period.periods.all():
+            per_day.setdefault(period.weekday, []).append(lesson_period)
+
+    context['lesson_periods'] = per_day
+
     return render(request, 'chronos/tt_week.html', context)
-- 
GitLab


From 8bcf0df51407f9ff041ad1ed94aeed893533b869 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:04:28 +0200
Subject: [PATCH 14/22] Order lesson periods dict by weekday.

---
 biscuit/apps/chronos/views.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py
index 09b0be2f..c9764eb0 100644
--- a/biscuit/apps/chronos/views.py
+++ b/biscuit/apps/chronos/views.py
@@ -1,3 +1,5 @@
+from collections import OrderedDict
+
 from django.contrib.auth.decorators import login_required
 from django.shortcuts import render
 
@@ -28,6 +30,6 @@ def timetable(request):
         for period in lesson_period.periods.all():
             per_day.setdefault(period.weekday, []).append(lesson_period)
 
-    context['lesson_periods'] = per_day
+    context['lesson_periods'] = OrderedDict(sorted(per_day.items()))
 
     return render(request, 'chronos/tt_week.html', context)
-- 
GitLab


From 8ca8445c2a0fb22c6695c887e375da1b9c2f0c3e Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:06:33 +0200
Subject: [PATCH 15/22] Render all days.

---
 biscuit/apps/chronos/templates/chronos/tt_week.html | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_week.html b/biscuit/apps/chronos/templates/chronos/tt_week.html
index f9f9a563..17a92d5d 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_week.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_week.html
@@ -5,5 +5,7 @@
 {% block page_title %}Timetable{% endblock %}
 
 {% block content %}
-{% include "chronos/tt_day.html" %}
+ {% for weekday, lesson_periods_day in lesson_periods.items %}
+  {% include "chronos/tt_day.html" with lesson_periods=lesson_periods_day %}
+ {% endfor %}
 {% endblock %}
-- 
GitLab


From 8ae2f7e03d5dfcb5d5f2a7468bf3ba6ce57cd2b8 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:18:58 +0200
Subject: [PATCH 16/22] Add selected filters to view.

---
 .../chronos/templates/chronos/tt_week.html    |  4 ++++
 biscuit/apps/chronos/views.py                 | 21 ++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_week.html b/biscuit/apps/chronos/templates/chronos/tt_week.html
index 17a92d5d..6bc25000 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_week.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_week.html
@@ -5,6 +5,10 @@
 {% block page_title %}Timetable{% endblock %}
 
 {% block content %}
+ <p>
+  {{ filter_descs }}
+ </p>
+
  {% for weekday, lesson_periods_day in lesson_periods.items %}
   {% include "chronos/tt_day.html" with lesson_periods=lesson_periods_day %}
  {% endfor %}
diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py
index c9764eb0..e52840d8 100644
--- a/biscuit/apps/chronos/views.py
+++ b/biscuit/apps/chronos/views.py
@@ -2,8 +2,11 @@ from collections import OrderedDict
 
 from django.contrib.auth.decorators import login_required
 from django.shortcuts import render
+from django.utils.translation import gettext_lazy as _
 
+from biscuit.apps.cambro.models import Room
 from biscuit.core.decorators import admin_required
+from biscuit.core.models import Group, Person
 
 from .models import LessonPeriod
 
@@ -14,22 +17,30 @@ def timetable(request):
     context = {}
 
     lesson_periods = LessonPeriod.objects.all()
+    filter_descs = []
 
     if 'group' in request.GET:
         lesson_periods = lesson_periods.filter(
-            lesson__groups__pk__contains=int(request.GET('group')))
+            lesson__groups__pk__contains=int(request.GET['group']))
+        filter_descs.append(_('Group: %s') % Group.objects.get(
+            pk=int(request.GET['group'])).name)
     if 'teacher' in request.GET:
         lesson_periods = lesson_periods.filter(
-            lesson__teachers__pk__contains=int(request.GET('teacher')))
+            lesson__teachers__pk__contains=int(request.GET['teacher']))
+        filter_descs.append(_('Teacher: %s') % Person.objects.get(
+            pk=int(request.GET['teacher'])).name)
     if 'room' in request.GET:
         lesson_periods = lesson_periods.filter(
-            room__pk=int(request.GET('room')))
+            room__pk=int(request.GET['room']))
+        filter_descs.append(_('Room: %s') % Room.objects.get(
+            pk=int(request.GET['room'])).name)
 
     per_day = {}
     for lesson_period in lesson_periods:
-        for period in lesson_period.periods.all():
-            per_day.setdefault(period.weekday, []).append(lesson_period)
+        per_day.setdefault(lesson_period.period.weekday,
+                           []).append(lesson_period)
 
     context['lesson_periods'] = OrderedDict(sorted(per_day.items()))
+    context['filter_descs'] = ', '.join(filter_descs)
 
     return render(request, 'chronos/tt_week.html', context)
-- 
GitLab


From 0a87e9f0516f288cca2988a72aaa8a1636943c79 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:22:04 +0200
Subject: [PATCH 17/22] Fix mistakes in template.

---
 biscuit/apps/chronos/templates/chronos/tt_lesson.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index c4a21a59..e2562f92 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -7,12 +7,12 @@
   </div>
   <div class="row">
    <div class="col-sm">
-    {% for group in lesson_period.lesosn.groups %}
+    {% for group in lesson_period.lesson.groups.all %}
      <span class="card-text">{{ group.short_name }}</span>
     {% endfor %}
    </div>
    <div class="col-sm">
-    {% for teacher in lesson_period.lesosn.teachers %}
+    {% for teacher in lesson_period.lesson.teachers.all %}
      <span class="card-text">{{ teacher.short_name }}</span>
     {% endfor %}
    </div>
-- 
GitLab


From 7444fc5881cc38666717a5fb08aa0b55b5823e9e Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:36:17 +0200
Subject: [PATCH 18/22] Add times and periods as first column.

---
 biscuit/apps/chronos/models.py                |  8 ++++
 .../chronos/templates/chronos/tt_week.html    | 38 ++++++++++++++++++-
 biscuit/apps/chronos/views.py                 |  3 +-
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/biscuit/apps/chronos/models.py b/biscuit/apps/chronos/models.py
index 3b27ed81..b1182497 100644
--- a/biscuit/apps/chronos/models.py
+++ b/biscuit/apps/chronos/models.py
@@ -24,6 +24,14 @@ class TimePeriod(models.Model):
     def __str__(self):
         return '%s, %d. period (%s - %s)' % (self.weekday, self.period, self.time_start, self.time_end)
 
+    @classmethod
+    def get_times_dict(cls):
+        periods = {}
+        for period in cls.objects.all():
+            periods[period.period] = (period.time_start, period.time_end)
+
+        return periods
+
 
 class Subject(models.Model):
     abbrev = models.CharField(verbose_name=_(
diff --git a/biscuit/apps/chronos/templates/chronos/tt_week.html b/biscuit/apps/chronos/templates/chronos/tt_week.html
index 6bc25000..c07d17de 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_week.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_week.html
@@ -1,6 +1,6 @@
 {# -*- engine:django -*- #}
 {% extends "core/base.html" %}
-{% load bootstrap4 %}
+{% load bootstrap4 i18n %}
 
 {% block page_title %}Timetable{% endblock %}
 
@@ -9,6 +9,42 @@
   {{ filter_descs }}
  </p>
 
+ <div class="float-left">
+  <ul class="list-group">
+   <li class="list-group-item active">
+    {% blocktrans %}Times{% endblocktrans %}
+   </li>
+  </ul>
+  <div class="container">
+   {% for num, times in periods.items %}
+    <div class="row">
+     <div class="col-sm">
+      <div class="card" style="width: 18rem; {% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
+       <div class="card-body">
+        <div class="row">
+         <div class="col-sm">
+          <span class="card-title">{{ num }}.</span>
+         </div>
+        </div>
+        <div class="row">
+         <div class="col-sm">
+          <span class="card-text">{{ times.0}}</span>
+         </div>
+         <div class="col-sm">
+          <span class="card-text">-</span>
+         </div>
+         <div class="col-sm">
+          <span class="card-text">{{ times.1 }}</span>
+         </div>
+        </div>
+       </div>
+      </div>
+     </div>
+    </div>
+   {% endfor %}
+  </div>
+ </div>
+
  {% for weekday, lesson_periods_day in lesson_periods.items %}
   {% include "chronos/tt_day.html" with lesson_periods=lesson_periods_day %}
  {% endfor %}
diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py
index e52840d8..776f7e92 100644
--- a/biscuit/apps/chronos/views.py
+++ b/biscuit/apps/chronos/views.py
@@ -8,7 +8,7 @@ from biscuit.apps.cambro.models import Room
 from biscuit.core.decorators import admin_required
 from biscuit.core.models import Group, Person
 
-from .models import LessonPeriod
+from .models import LessonPeriod, TimePeriod
 
 
 @login_required
@@ -42,5 +42,6 @@ def timetable(request):
 
     context['lesson_periods'] = OrderedDict(sorted(per_day.items()))
     context['filter_descs'] = ', '.join(filter_descs)
+    context['periods'] = TimePeriod.get_times_dict()
 
     return render(request, 'chronos/tt_week.html', context)
-- 
GitLab


From c7b9b426f4cc06cf8e2d1bd0999a4d36adef2c10 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:38:36 +0200
Subject: [PATCH 19/22] Use bootstrap grid for week view.

---
 .../chronos/templates/chronos/tt_day.html     |  2 +-
 .../chronos/templates/chronos/tt_week.html    | 65 ++++++++++---------
 2 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_day.html b/biscuit/apps/chronos/templates/chronos/tt_day.html
index 4e37be64..97aea6a0 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_day.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_day.html
@@ -1,4 +1,4 @@
-<div class="float-left">
+<div class="col-sm">
  <ul class="list-group">
   <li class="list-group-item active">
    {{ lesson_periods.0.period.get_weekday_display }}
diff --git a/biscuit/apps/chronos/templates/chronos/tt_week.html b/biscuit/apps/chronos/templates/chronos/tt_week.html
index c07d17de..b2bed204 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_week.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_week.html
@@ -9,43 +9,46 @@
   {{ filter_descs }}
  </p>
 
- <div class="float-left">
-  <ul class="list-group">
-   <li class="list-group-item active">
-    {% blocktrans %}Times{% endblocktrans %}
-   </li>
-  </ul>
-  <div class="container">
-   {% for num, times in periods.items %}
-    <div class="row">
-     <div class="col-sm">
-      <div class="card" style="width: 18rem; {% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
-       <div class="card-body">
-        <div class="row">
-         <div class="col-sm">
-          <span class="card-title">{{ num }}.</span>
+ <div class="row">
+  <div class="col-sm">
+   <ul class="list-group">
+    <li class="list-group-item active">
+     {% blocktrans %}Times{% endblocktrans %}
+    </li>
+   </ul>
+   <div class="container">
+    {% for num, times in periods.items %}
+     <div class="row">
+      <div class="col-sm">
+       <div class="card" style="width: 18rem; {% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
+        <div class="card-body">
+         <div class="row">
+          <div class="col-sm">
+           <span class="card-title">{{ num }}.</span>
+          </div>
          </div>
-        </div>
-        <div class="row">
-         <div class="col-sm">
-          <span class="card-text">{{ times.0}}</span>
-         </div>
-         <div class="col-sm">
-          <span class="card-text">-</span>
-         </div>
-         <div class="col-sm">
-          <span class="card-text">{{ times.1 }}</span>
+         <div class="row">
+          <div class="col-sm">
+           <span class="card-text">{{ times.0}}</span>
+          </div>
+          <div class="col-sm">
+           <span class="card-text">-</span>
+          </div>
+          <div class="col-sm">
+           <span class="card-text">{{ times.1 }}</span>
+          </div>
          </div>
         </div>
        </div>
       </div>
      </div>
-    </div>
-   {% endfor %}
+    {% endfor %}
+   </div>
   </div>
+ 
+  {% for weekday, lesson_periods_day in lesson_periods.items %}
+   {% include "chronos/tt_day.html" with lesson_periods=lesson_periods_day %}
+  {% endfor %}
  </div>
-
- {% for weekday, lesson_periods_day in lesson_periods.items %}
-  {% include "chronos/tt_day.html" with lesson_periods=lesson_periods_day %}
- {% endfor %}
 {% endblock %}
+ 
\ No newline at end of file
-- 
GitLab


From ea85bb3ed829a0f8624cc9dff3ceb35eb0c38d6b Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:40:50 +0200
Subject: [PATCH 20/22] Remove explicit width for timetable card.

---
 biscuit/apps/chronos/templates/chronos/tt_lesson.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index e2562f92..cde39ded 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -1,4 +1,4 @@
-<div class="card" style="width: 18rem; {% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
+<div class="card" style="{% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
  <div class="card-body">
   <div class="row">
    <div class="col-sm">
-- 
GitLab


From 85fec2c93ca6ad3a192cdabd913405b68d072424 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:51:02 +0200
Subject: [PATCH 21/22] Fix CSS for lessons.

---
 biscuit/apps/chronos/templates/chronos/tt_lesson.html | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index cde39ded..104fa319 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -1,4 +1,12 @@
-<div class="card" style="{% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
+<div class="card"
+ style="
+  {% 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 %}
+ ">
  <div class="card-body">
   <div class="row">
    <div class="col-sm">
-- 
GitLab


From 1c59e3312ea18d7c9c0e6b4a4c534947bd127926 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Thu, 18 Jul 2019 00:53:59 +0200
Subject: [PATCH 22/22] Use chronos-lesson CSS class.

---
 biscuit/apps/chronos/templates/chronos/tt_lesson.html | 2 +-
 biscuit/apps/chronos/templates/chronos/tt_week.html   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/biscuit/apps/chronos/templates/chronos/tt_lesson.html b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
index 104fa319..bd58b5cb 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_lesson.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_lesson.html
@@ -1,4 +1,4 @@
-<div class="card"
+<div class="card chronos-lesson"
  style="
   {% if lesson_period.lesson.subject.colour_fg %}
    color: {{ lesson_period.lesson.subject.colour_fg }};
diff --git a/biscuit/apps/chronos/templates/chronos/tt_week.html b/biscuit/apps/chronos/templates/chronos/tt_week.html
index b2bed204..dc9052ad 100644
--- a/biscuit/apps/chronos/templates/chronos/tt_week.html
+++ b/biscuit/apps/chronos/templates/chronos/tt_week.html
@@ -20,7 +20,7 @@
     {% for num, times in periods.items %}
      <div class="row">
       <div class="col-sm">
-       <div class="card" style="width: 18rem; {% if lesson.colour_fg %} color: {{ lesson.colour_fg }}; {% endif %} {% if lesson.colour_bg %} background-color: {{ lesson.colour_bg }}; {% endif %}">
+       <div class="card chronos-lesson">
         <div class="card-body">
          <div class="row">
           <div class="col-sm">
-- 
GitLab