fixed paging

This commit is contained in:
anhefti 2021-05-18 09:30:20 +02:00
parent d7e52efac9
commit 3a06f9937f

View file

@ -165,8 +165,13 @@ public interface LmsAPIService {
quizzes.subList(start, end)); quizzes.subList(start, end));
} }
final int mod = quizzes.size() % pageSize;
return new Page<>( return new Page<>(
(quizzes.size() <= pageSize) ? 1 : quizzes.size() / pageSize + 1, (quizzes.size() <= pageSize)
? 1
: (mod > 0)
? quizzes.size() / pageSize + 1
: quizzes.size() / pageSize,
pageNumber, pageNumber,
sortAttribute, sortAttribute,
quizzes.subList(start, end)); quizzes.subList(start, end));