summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
diff options
context:
space:
mode:
authorSimon Rettberg2017-01-13 13:03:42 +0100
committerSimon Rettberg2017-01-13 13:03:42 +0100
commite757d5904d5ee3db61d06b034b3023368e2dd94c (patch)
tree40b21dfb8c0f0d4821bb7adf6552b9be695f7ed4 /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
parent[server] use mail template from the configuration database when generating ma... (diff)
downloadtutor-module-e757d5904d5ee3db61d06b034b3023368e2dd94c.tar.gz
tutor-module-e757d5904d5ee3db61d06b034b3023368e2dd94c.tar.xz
tutor-module-e757d5904d5ee3db61d06b034b3023368e2dd94c.zip
[server] Refine mail template parsing; fix too many mails being sent for invalid lectures
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java11
1 files changed, 7 insertions, 4 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 8a8f6bd9..147b6b8a 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
@@ -250,9 +250,12 @@ public class DbLecture {
}
protected static List<LectureSummary> getAllUsingImageVersion(MysqlConnection connection,
- String imageVersionId) throws SQLException {
- MysqlStatement stmt = connection.prepareStatement(summaryBaseSql
- + " WHERE imageversionid = :imageversionid");
+ String imageVersionId, boolean enabledOnly) throws SQLException {
+ String query = summaryBaseSql + " WHERE i.imageversionid = :imageversionid";
+ if (enabledOnly) {
+ query += " AND l.isenabled = 1";
+ }
+ MysqlStatement stmt = connection.prepareStatement(query);
stmt.setString("imageversionid", imageVersionId);
stmt.setString("userid", "-");
ResultSet rs = stmt.executeQuery();
@@ -398,7 +401,7 @@ public class DbLecture {
|| (newVersion != null && newVersion.imageVersionId.equals(oldVersion.imageVersionId)))
return;
// First, get list of lectures using the image version to switch away from
- List<LectureSummary> lectures = getAllUsingImageVersion(connection, oldVersion.imageVersionId);
+ List<LectureSummary> lectures = getAllUsingImageVersion(connection, oldVersion.imageVersionId, true);
if (lectures.isEmpty())
return;
MysqlStatement stmt;