Skip to content
Snippets Groups Projects
Commit 93b70919 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add corridors and supervisions to substitutions

parent 16e9cd0d
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -90,10 +90,18 @@
<tr
{% if sub.type == 1 or sub.type == 2 %}
class="green-text"
{% elif sub.type == 3 %}
class="blue-text"
{% endif %}
>
<td>
<strong>{{ sub.lesson }}.</strong>
<strong>
{% if sub.type == 3 %}
{{ sub.lesson|add:-1 }}./{{ sub.lesson }}.
{% else %}
{{ sub.lesson }}.
{% endif %}
</strong>
</td>
<td>
{% for class_ in sub.classes %}
......@@ -113,7 +121,9 @@
{% endif %}
</td>
<td>
{% if sub.type == 1 or sub.type == 2 %}
{% if sub.type == 3 %}
<span class="badge new blue">Aufsicht</span>
{% elif sub.type == 1 or sub.type == 2 %}
<s>{{ sub.subject_old.shortcode }}</s>
{% elif sub.subject_new and sub.subject_old %}
<s>{{ sub.subject_old.shortcode }}</s>
......@@ -125,7 +135,9 @@
{% endif %}
</td>
<td>
{% if sub.type == 1 or sub.type == 2 %}
{% if sub.type == 3 %}
{{ sub.corridor.name }}
{% elif sub.type == 1 or sub.type == 2 %}
{% elif sub.room_new and sub.room_old %}
<s>
{{ sub.room_old.shortcode }}
......@@ -152,8 +164,7 @@
Lehrer frei</span>
{% endif %}
</td>
<td>
<small>{{ sub.id }} {{ sub.lesson_id }}</small>
</td>
</tr>
......
......@@ -158,6 +158,38 @@ def get_room_by_id(id):
return one_by_id(room, Room)
########
# CORRIDOR #
########
class Corridor(object):
def __init__(self):
self.filled = False
self.id = None
self.name = None
def __str__(self):
if self.filled:
return self.name or "Unbekannt"
else:
return "Unbekannt"
def create(self, db_obj):
self.filled = True
self.id = db_obj.corridor_id
self.name = db_obj.name
def get_all_corridors():
corridors = row_by_row(models.Corridor, Corridor, filter_term=False)
return corridors
def get_corridor_by_id(id):
print(id)
corridor = run_one(models.Corridor.objects, filter_term=False).get(corridor_id=id)
return one_by_id(corridor, Corridor)
###########
# SUBJECT #
###########
......
......@@ -2,7 +2,7 @@ from django.utils import timezone
from untisconnect import models
from untisconnect.api import run_default_filter, row_by_row_helper, get_teacher_by_id, get_subject_by_id, \
get_room_by_id, get_class_by_id
get_room_by_id, get_class_by_id, get_corridor_by_id
from untisconnect.api_helper import run_using, untis_split_first
from untisconnect.parse import get_lesson_by_id, get_lesson_element_by_id_and_teacher
......@@ -20,7 +20,7 @@ def date_to_untis_date(date):
TYPE_SUBSTITUTION = 0
TYPE_CANCELLATION = 1
TYPE_TEACHER_CANCELLATION = 2
TYPE_CORRIDOR = 3
def parse_type_of_untis_flags(flags):
type_ = TYPE_SUBSTITUTION
......@@ -100,9 +100,12 @@ class Substitution(object):
self.room_new = None
# if self.rooms_old
print(self.room_new)
self.corridor = db_obj.corridor_id
# print(self.room_new)
# print("CORRIDOR")
# print(self.corridor)
if db_obj.corridor_id != 0:
self.corridor = get_corridor_by_id(db_obj.corridor_id)
self.type = TYPE_CORRIDOR
# Classes
self.classes = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment