From 038a7463e1f870d0dddbb3ea4687e5963bf8e0f5 Mon Sep 17 00:00:00 2001 From: Tunde Akinyanmi Date: Fri, 13 Oct 2023 18:39:11 +0100 Subject: [PATCH] update `get_neighbours` to use `LessonBookmark` and return the correct bookmark string --- lms/www/batch/learn.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lms/www/batch/learn.py b/lms/www/batch/learn.py index 72499273..a1030a28 100644 --- a/lms/www/batch/learn.py +++ b/lms/www/batch/learn.py @@ -158,10 +158,10 @@ class LessonBookmark: def get_neighbours(current, lessons): - current = flt(current) - numbers = sorted(lesson.number for lesson in lessons) - index = numbers.index(current) + _current = LessonBookmark(current) + numbers = sorted([LessonBookmark(lesson.number) for lesson in lessons]) + index = numbers.index(_current) return { - "prev": numbers[index - 1] if index - 1 >= 0 else None, - "next": numbers[index + 1] if index + 1 < len(numbers) else None, + "prev": numbers[index - 1].readable_value if index - 1 >= 0 else None, + "next": numbers[index + 1].readable_value if index + 1 < len(numbers) else None, }