Skip to content
Snippets Groups Projects
Commit 7e870d37 authored by Jonathan Weth's avatar Jonathan Weth :keyboard: Committed by root
Browse files

Merge branch 'dev' into feature/top-box-sub

parents db44eb0b a184877c
No related branches found
No related tags found
No related merge requests found
......@@ -247,8 +247,18 @@ class Subject(object):
self.shortcode = db_obj.name
self.name = db_obj.longname
self.color = db_obj.backcolor
# Convert UNTIS number to HEX
hex_bgr = str(hex(db_obj.backcolor)).replace("0x", "")
hex_rgb = hex_bgr[4:5] + hex_bgr[2:3] + hex_bgr[0:1]
# Add beginning zeros if len < 6
if len(hex_bgr) < 6:
hex_bgr = "0" * (6 - len(hex_bgr)) + hex_bgr
# Change BGR to RGB
hex_rgb = hex_bgr[4:6] + hex_bgr[2:4] + hex_bgr[0:2]
# Add html #
self.hex_color = "#" + hex_rgb
......
......@@ -189,8 +189,8 @@ def get_lesson_element_by_id_and_teacher(lesson_id, teacher, hour=None, weekday=
# print(t)
room = None
if t is not None and len(t.rooms) > i:
print(t.rooms)
print(len(t.rooms))
# print(t.rooms)
# print(len(t.rooms))
room = t.rooms[i]
if el is not None:
......
......@@ -41,7 +41,8 @@ class LessonElementContainer(object):
self.room = room
self.substitution = substitution
self.is_old = False
self.classes_formatted = format_classes(self.element.classes)
if self.element is not None:
self.classes_formatted = format_classes(self.element.classes)
def parse_lesson_times():
......
......@@ -64,12 +64,17 @@ class Substitution(object):
# print(db_obj.teacher_idlessn)
if db_obj.teacher_idlessn != 0:
self.teacher_old = drive["teachers"][db_obj.teacher_idlessn]
if db_obj.teacher_idsubst != 0:
self.teacher_new = drive["teachers"][db_obj.teacher_idsubst]
if self.teacher_old is not None and self.teacher_new.id == self.teacher_old.id:
self.teacher_new = None
if self.teacher_old is None and self.teacher_new is not None:
self.teacher_old = self.teacher_new
self.teacher_new = None
self.lesson_element, self.room_old = get_lesson_element_by_id_and_teacher(self.lesson_id, self.teacher_old,
self.lesson, self.date.weekday() + 1)
# print(self.lesson)
......@@ -142,6 +147,8 @@ class SubRow(object):
def generate_teacher_row(sub, full=False):
# print(sub.id)
teacher = ""
if sub.type == 1:
teacher = "<s>{}</s>".format(sub.teacher_old.shortcode if not full else sub.teacher_old.name)
......@@ -151,7 +158,7 @@ def generate_teacher_row(sub, full=False):
sub.teacher_new.shortcode if not full else sub.teacher_new.name)
elif sub.teacher_new and not sub.teacher_old:
teacher = "<strong>{}</strong>".format(sub.teacher_new.shortcode if not full else sub.teacher_new.name)
else:
elif sub.teacher_old:
teacher = "<strong>{}</strong>".format(sub.teacher_old.shortcode if not full else sub.teacher_old.name)
return teacher
......@@ -160,6 +167,8 @@ def generate_teacher_row(sub, full=False):
def generate_subject_row(sub, full=False):
if sub.type == 3:
subject = "Aufsicht"
elif not sub.subject_new and not sub.subject_old:
subject = ""
elif sub.type == 1 or sub.type == 2:
subject = "<s>{}</s>".format(sub.subject_old.shortcode if not full else sub.subject_old.name)
elif sub.subject_new and sub.subject_old:
......@@ -168,8 +177,6 @@ def generate_subject_row(sub, full=False):
sub.subject_new.shortcode if not full else sub.subject_new.name)
elif sub.subject_new and not sub.subject_old:
subject = "<strong>{}</strong>".format(sub.subject_new.shortcode if not full else sub.subject_new.name)
elif not sub.subject_new and not sub.subject_old:
subject = ""
else:
subject = "<strong>{}</strong>".format(sub.subject_old.shortcode if not full else sub.subject_old.name)
......
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