diff --git a/biscuit/apps/untis/sub.py b/biscuit/apps/untis/sub.py index 966831d8a5af04c9456219504602ec8b1156d78f..8b1efef428b2c8bde67fab6b9513be00da797850 100644 --- a/biscuit/apps/untis/sub.py +++ b/biscuit/apps/untis/sub.py @@ -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