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

Add cancellation detection

parent 24575d22
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -87,7 +87,11 @@
</thead>
<tbody>
{% for sub in subs %}
<tr>
<tr
{% if sub.type == 1 or sub.type == 2 %}
class="green-text"
{% endif %}
>
<td>
<strong>{{ sub.lesson }}.</strong>
</td>
......@@ -97,7 +101,9 @@
{% endfor %}
</td>
<td>
{% if sub.teacher_new and sub.teacher_old %}
{% if sub.type == 1 %}
<s>{{ sub.teacher_old.shortcode }}</s>
{% elif sub.teacher_new and sub.teacher_old %}
<s>{{ sub.teacher_old.shortcode }}</s>
<strong>{{ sub.teacher_new.shortcode }}</strong>
{% elif sub.teacher_new and not sub.teacher_old %}
......@@ -107,7 +113,9 @@
{% endif %}
</td>
<td>
{% if sub.subject_new and sub.subject_old %}
{% if 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>
<strong>{{ sub.subject_new.shortcode }}</strong>
{% elif sub.subject_new and not sub.subject_old %}
......@@ -117,7 +125,8 @@
{% endif %}
</td>
<td>
{% if sub.room_new and sub.room_old %}
{% if sub.type == 1 or sub.type == 2 %}
{% elif sub.room_new and sub.room_old %}
<s>
{{ sub.room_old.shortcode }}
</s><strong>{{ sub.room_new.shortcode }}</strong>
......@@ -134,6 +143,16 @@
<td>
<em>{{ sub.text|default:"" }}</em>
</td>
<td>
{% if sub.type == 1 %}
<span class="badge green">
Schüler frei</span>
{% elif sub.type == 2 %}
<span class="badge green">
Lehrer frei</span>
{% endif %}
</td>
<td>
<small>{{ sub.id }} {{ sub.lesson_id }}</small>
</td>
......
......@@ -17,6 +17,20 @@ def date_to_untis_date(date):
return date.strftime(DATE_FORMAT)
TYPE_SUBSTITUTION = 0
TYPE_CANCELLATION = 1
TYPE_TEACHER_CANCELLATION = 2
def parse_type_of_untis_flags(flags):
type_ = TYPE_SUBSTITUTION
if "E" in flags:
type_ = TYPE_CANCELLATION
elif "F" in flags:
type_ = TYPE_TEACHER_CANCELLATION
return type_
class Substitution(object):
def __init__(self):
self.filled = False
......@@ -48,7 +62,7 @@ class Substitution(object):
self.lesson_id = db_obj.lesson_idsubst
self.date = untis_date_to_date(db_obj.date)
self.lesson = db_obj.lesson
self.type = list(db_obj.flags)
self.type = parse_type_of_untis_flags(db_obj.flags)
self.text = db_obj.text
# Lesson
......
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