diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f61c4ed035d8c3668f3afb3ff78315b282d9ecb5..94c227f195fb9157ea44ba88e6df978860afedb9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,6 +21,7 @@ Fixed user language (fixed by using gettext_lazy). * Affected groups and persons in substitutions list were displayed multiple times. * ``lessons_on_day`` didn't work as expected if a person has no lessons. +* End of validity ranges list wasn't detected correctly in ``next_lesson``. `2.0b2` - 2021-06-02 -------------------- diff --git a/aleksis/apps/chronos/managers.py b/aleksis/apps/chronos/managers.py index 042d91a61cbd4b71921577fa2473abf9c08c27b6..d03589aac4d36e1f640cff5e793a27cfdc0d6b52 100644 --- a/aleksis/apps/chronos/managers.py +++ b/aleksis/apps/chronos/managers.py @@ -465,7 +465,7 @@ class LessonDataQuerySet(models.QuerySet, WeekQuerySetMixin): # If date of next lesson period is out of validity range (larger) ... elif next_lesson_period_date > next_lesson_period.lesson.validity.date_end: # ... we have to get the lesson period from the next validity range - if validity_index >= len(validity_ranges): + if validity_index >= len(validity_ranges) - 1: # There are no validity ranges (and thus no lessons) # in the school term after this lesson period return None