Skip to content
Snippets Groups Projects
Commit 2575db50 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch...

Merge branch '110-let-next-prev_lesson-return-none-if-the-person-isn-t-a-participant-of-the-lesson' into 'master'

Resolve "Let next/prev_lesson return None if the person isn't a participant of the lesson"

Closes #110

See merge request !132
parents abd57121 b3107932
No related branches found
No related tags found
1 merge request!132Resolve "Let next/prev_lesson return None if the person isn't a participant of the lesson"
Pipeline #6101 passed
......@@ -97,6 +97,12 @@ def _adjacent_lesson(
return None
ids = list(daily_lessons.values_list("id", flat=True))
# Check if the lesson period is one of the person's lesson periods on this day
# and return None if it's not so
if lesson_period.pk not in ids:
return None
index = ids.index(lesson_period.pk)
if (offset > 0 and index + offset < len(ids)) or (offset < 0 and index >= -offset):
......
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