summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src
diff options
context:
space:
mode:
authorSimon Rettberg2023-03-31 14:11:38 +0200
committerSimon Rettberg2023-03-31 14:11:38 +0200
commitd97c3551fb7a27bddcd5e7df06a8c13be11a2903 (patch)
tree0a9c7baf312075327cb5ecaea813ee80c5241548 /dozentenmodulserver/src
parent[server] Add JSON/HTTP listener for thrift (diff)
downloadtutor-module-d97c3551fb7a27bddcd5e7df06a8c13be11a2903.tar.gz
tutor-module-d97c3551fb7a27bddcd5e7df06a8c13be11a2903.tar.xz
tutor-module-d97c3551fb7a27bddcd5e7df06a8c13be11a2903.zip
[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.
Diffstat (limited to 'dozentenmodulserver/src')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java4
1 files changed, 3 insertions, 1 deletions
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<LectureSummary> 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<LectureSummary> list = new ArrayList<>(100);