diff options
Diffstat (limited to 'management/commands/_private.py')
-rw-r--r-- | management/commands/_private.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/management/commands/_private.py b/management/commands/_private.py index 4e84363..7b71fc6 100644 --- a/management/commands/_private.py +++ b/management/commands/_private.py @@ -43,27 +43,31 @@ def get_events(soup, weeks, week, timetable): type_ = None groups = None rooms = None + notes = None if weeks[event.rawweeks.text].number != week: continue if event.resources.module is not None: - title = event.resources.module.text + title = event.resources.module.item.text - if event.category is not None and title is not None: + if event.category is not None: type_ = event.category.text - if event.resources.group is not None and type_ is not None: + if event.resources.group is not None: groups = [get_from_db_or_create(Group, item.text, timetable) for item in event.resources.group.find_all("item")] - if event.resources.room is not None and groups is not None: - rooms = [get_from_db_or_create(Room, item.text) for item in event.resources.room.find_all("item")] + if event.resources.room is not None: + rooms = [get_from_db_or_create(Room, item.text) for item in event.resources.room.find_all("item")] + + if event.notes is not None: + notes = event.notes.text date = weeks[event.rawweeks.text].get_day(int(event.day.text)) begin = add_time(date, datetime.datetime.strptime(event.starttime.text, "%H:%M")) end = add_time(date, datetime.datetime.strptime(event.endtime.text, "%H:%M")) - yield title, type_, groups, rooms, begin, end + yield title, type_, groups, rooms, notes, begin, end def get_weeks(soup): weeks = {} |