diff --git a/aleksis/apps/chronos/managers.py b/aleksis/apps/chronos/managers.py index ca92c3ebe735ff3d60379d68e93fbcc4d1a5df47..c7bab932913248876f9d5661cb3e7093b7be805c 100644 --- a/aleksis/apps/chronos/managers.py +++ b/aleksis/apps/chronos/managers.py @@ -420,8 +420,8 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin): year = reference._year if week < 1: year -= 1 - week = CalendarWeek.get_last_week_of_year(year) - elif week > CalendarWeek.get_last_week_of_year(year): + week = CalendarWeek.get_last_week_of_year(year).week + elif week > CalendarWeek.get_last_week_of_year(year).week: year += 1 week = 1 @@ -429,7 +429,7 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin): # to check whether the validity range has to be changed week = CalendarWeek(week=week, year=year) next_lesson_period = current_lesson_periods[next_index] - next_lesson_period_date = week_weekday_to_date(week, next_lesson_period.period.period) + next_lesson_period_date = week_weekday_to_date(week, next_lesson_period.period.weekday) validity_index = validity_ranges.index(next_lesson_period.lesson.validity) diff --git a/aleksis/apps/chronos/models.py b/aleksis/apps/chronos/models.py index a883414aad27e5fe01702561e5d15f1b6da30871..209155a4a1c306acfbbf96d099a3e5970d286b86 100644 --- a/aleksis/apps/chronos/models.py +++ b/aleksis/apps/chronos/models.py @@ -369,7 +369,7 @@ class Lesson(ValidityRangeRelatedExtensibleModel, GroupPropertiesMixin, TeacherP verbose_name_plural = _("Lessons") -class LessonSubstitution(ExtensibleModel, WeekRelatedMixin): +class LessonSubstitution(ExtensibleModel, TeacherPropertiesMixin, WeekRelatedMixin): objects = LessonSubstitutionManager.from_queryset(LessonSubstitutionQuerySet)() week = models.IntegerField(verbose_name=_("Week"), default=CalendarWeek.current_week) diff --git a/aleksis/apps/chronos/util/build.py b/aleksis/apps/chronos/util/build.py index d7c189860c376c04a504a0769dcf7023f2b8ab86..185c8f543eac3ac280a1036117414b165044c6e7 100644 --- a/aleksis/apps/chronos/util/build.py +++ b/aleksis/apps/chronos/util/build.py @@ -127,7 +127,7 @@ def build_timetable( for period in range(period_from, period_to + 1): if period not in events_per_period: - events_per_period[period] = [] if is_person else {} + events_per_period[period] = {} if is_week else [] if is_week and weekday not in events_per_period[period]: events_per_period[period][weekday] = []