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

Add corridors and supervisions to substitutions

parent 9ad6370b
No related branches found
No related tags found
No related merge requests found
......@@ -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