diff --git a/biscuit/apps/untis/api.py b/biscuit/apps/untis/api.py index e706287c7b2be7ec5b225f197407ebfe5ed6b955..313067603011e3d4a493980e98c36c0e60e4c686 100755 --- a/biscuit/apps/untis/api.py +++ b/biscuit/apps/untis/api.py @@ -92,6 +92,7 @@ class Teacher(object): def get_all_teachers(): teachers = row_by_row(models.Teacher, Teacher) + teachers.sort(key=lambda a: a.shortcode) return teachers @@ -145,6 +146,7 @@ class Class(object): def get_all_classes(): classes = row_by_row(models.Class, Class) + classes.sort(key=lambda a: a.name) return classes @@ -217,8 +219,9 @@ class Room(object): def get_all_rooms(): - db_rooms = row_by_row(models.Room, Room) - return db_rooms + rooms = row_by_row(models.Room, Room) + rooms.sort(key=lambda a: a.shortcode) + return rooms def get_room_by_id(id): @@ -256,6 +259,7 @@ class Corridor(object): def get_all_corridors(): corridors = row_by_row(models.Corridor, Corridor, filter_term=False) + corridors.sort(key=lambda a: a.name) return corridors @@ -312,8 +316,10 @@ class Subject(object): def get_all_subjects(): - db_rooms = row_by_row(models.Subjects, Subject, filter_term=False) - return db_rooms + subjects = row_by_row(models.Subjects, Subject, filter_term=False) + subjects.sort(key=lambda a: a.shortcode) + + return subjects def get_subject_by_id(id): diff --git a/biscuit/apps/untis/sub.py b/biscuit/apps/untis/sub.py index d116a4d598186ff555bfb95882ff3aedfd39485f..7b9236df619ead2b012683c41c6bb96be969d5f4 100644 --- a/biscuit/apps/untis/sub.py +++ b/biscuit/apps/untis/sub.py @@ -303,6 +303,7 @@ def get_header_information(subs, date, events=[]): # Teacher is only missing a part of day elements.append( "{} ({}.-{}.)".format(absence.teacher.shortcode, absence.from_lesson, absence.to_lesson)) + elements.sort() joined = ", ".join(elements) info.rows.append(("Abwesende Lehrkräfte", joined))