Let next/prev_lesson return None if the person isn't a participant of the lesson
When trying to view a single lesson in the class register, this error comes up. I believe it has something to do with getting the next lesson.
Traceback:
Traceback (most recent call last):
File "/home/lolo/Programmierung/AlekSIS/AlekSIS/.venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/lolo/Programmierung/AlekSIS/AlekSIS/.venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/home/lolo/Programmierung/AlekSIS/AlekSIS/.venv/lib/python3.8/site-packages/rules/contrib/views.py", line 221, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/lolo/Programmierung/AlekSIS/AlekSIS/apps/official/AlekSIS-App-Alsijil/aleksis/apps/alsijil/views.py", line 94, in lesson
next_lesson = request.user.person.next_lesson(lesson_period, date_of_lesson)
File "/home/lolo/Programmierung/AlekSIS/AlekSIS/.venv/lib/python3.8/site-packages/aleksis/apps/chronos/model_extensions.py", line 113, in next_lesson
return self._adjacent_lesson(lesson_period, day)
File "/home/lolo/Programmierung/AlekSIS/AlekSIS/.venv/lib/python3.8/site-packages/aleksis/apps/chronos/model_extensions.py", line 100, in _adjacent_lesson
index = ids.index(lesson_period.pk)
ValueError: 1586 is not in list
Edited by Jonathan Weth