SEBSERV-449 fixed name search on Moodle side and fixed query SEB Server

This commit is contained in:
anhefti 2023-06-19 13:36:15 +02:00
parent 0314005237
commit 06e8c9b4e8

View file

@ -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<String, String> 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) +
"')";
}