From 3a06f9937ffa496c35e072216f29334c3d439bd7 Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 18 May 2021 09:30:20 +0200 Subject: [PATCH] fixed paging --- .../webservice/servicelayer/lms/LmsAPIService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/LmsAPIService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/LmsAPIService.java index 468e424a..5958bb54 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/LmsAPIService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/LmsAPIService.java @@ -165,8 +165,13 @@ public interface LmsAPIService { quizzes.subList(start, end)); } + final int mod = quizzes.size() % pageSize; 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, sortAttribute, quizzes.subList(start, end));