From d97c3551fb7a27bddcd5e7df06a8c13be11a2903 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 31 Mar 2023 14:11:38 +0200 Subject: [server] Add missing pagination for lecture list This bug lead to a nice infinite loop on the client as soon as we hit the pagination thresold. --- .../main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java index ab9d3343..ee24f8af 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java @@ -14,6 +14,7 @@ import org.apache.logging.log4j.Logger; import org.openslx.bwlp.sat.database.Database; import org.openslx.bwlp.sat.database.MysqlConnection; import org.openslx.bwlp.sat.database.MysqlStatement; +import org.openslx.bwlp.sat.database.Paginator; import org.openslx.bwlp.sat.database.models.LocalImageVersion; import org.openslx.bwlp.sat.mail.MailGenerator; import org.openslx.bwlp.sat.permissions.User; @@ -246,7 +247,8 @@ public class DbLecture { public static List getAll(UserInfo user, int page) throws SQLException { try (MysqlConnection connection = Database.getConnection()) { MysqlStatement stmt = connection.prepareStatement(summaryBaseSql - + (User.isStudent(user) ? " WHERE i.isrestricted = 0" : "")); + + (User.isStudent(user) ? " WHERE i.isrestricted = 0" : "") + + Paginator.limitStatement(page)); stmt.setString("userid", user == null ? "-" : user.userId); ResultSet rs = stmt.executeQuery(); List list = new ArrayList<>(100); -- cgit v1.2.3-55-g7522