diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/plugin/MoodlePluginCourseAccess.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/plugin/MoodlePluginCourseAccess.java index d8568f3b..a5505674 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/plugin/MoodlePluginCourseAccess.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/plugin/MoodlePluginCourseAccess.java @@ -82,6 +82,9 @@ public class MoodlePluginCourseAccess extends AbstractCachedCourseAccess impleme public static final String PARAM_PAGE_START = "startneedle"; public static final String PARAM_PAGE_SIZE = "perpage"; + public static final String SQL_QUIZ_NAME = "m.name"; + public static final String SQL_COURSE_NAME = "shortname"; + public static final String SQL_CONDITION_TEMPLATE = //"(startdate >= %s or timecreated >=%s) and (enddate is null or enddate = 0 or enddate >= %s)"; "(startdate is null OR startdate = 0 OR startdate >= %s) AND (enddate is null or enddate = 0 OR enddate >= %s)"; @@ -437,9 +440,13 @@ public class MoodlePluginCourseAccess extends AbstractCachedCourseAccess impleme final LinkedMultiValueMap attributes = new LinkedMultiValueMap<>(); if (this.applyNameCriteria && StringUtils.isNotBlank(nameCondition)) { - sqlCondition = sqlCondition + " AND (name LIKE '" + + sqlCondition = sqlCondition + " AND (" + + SQL_QUIZ_NAME + + " LIKE '" + Utils.toSQLWildcard(nameCondition) + - "' OR shortname LIKE '" + + "' OR " + + SQL_COURSE_NAME + + " LIKE '" + Utils.toSQLWildcard(nameCondition) + "')"; }