SEBSERV-449 fixed name query

This commit is contained in:
anhefti 2023-06-15 10:40:50 +02:00
parent 2c7f4b8e09
commit 90d403c2b3
3 changed files with 6 additions and 4 deletions

View file

@ -438,8 +438,10 @@ public class MoodlePluginCourseAccess extends AbstractCachedCourseAccess impleme
// TODO clarify with Amr and Luca if this is OK
// and if it is possible to apply the nameCondition also the the course name (shortname)
if (this.applyNameCriteria && StringUtils.isNotBlank(nameCondition)) {
sqlCondition = sqlCondition + " AND (m.name LIKE '" +
if (StringUtils.isNotBlank(nameCondition)) {
sqlCondition = sqlCondition + " AND (name LIKE '" +
Utils.toSQLWildcard(nameCondition) +
"' OR shortname LIKE '" +
Utils.toSQLWildcard(nameCondition) +
"')";
}

View file

@ -57,7 +57,7 @@ public class MooldePluginLmsAPITemplateFactory implements LmsAPITemplateFactory
final ExamConfigurationValueService examConfigurationValueService,
final ClientHttpRequestFactoryService clientHttpRequestFactoryService,
@Value("${sebserver.webservice.lms.moodle.api.token.request.paths:}") final String alternativeTokenRequestPaths,
@Value("${sebserver.webservice.lms.moodle.fetch.applyNameCriteria:false}") final boolean applyNameCriteria) {
@Value("${sebserver.webservice.lms.moodle.fetch.applyNameCriteria:true}") final boolean applyNameCriteria) {
this.jsonMapper = jsonMapper;
this.cacheManager = cacheManager;

View file

@ -81,7 +81,7 @@ sebserver.webservice.lms.openedx.api.token.request.paths=/oauth2/access_token
sebserver.webservice.lms.moodle.api.token.request.paths=/login/token.php
sebserver.webservice.lms.moodle.prependShortCourseName=true
sebserver.webservice.lms.moodle.fetch.cutoffdate.yearsBeforeNow=2
sebserver.webservice.lms.moodle.fetch.applyNameCriteria=false
sebserver.webservice.lms.moodle.fetch.applyNameCriteria=true
sebserver.webservice.lms.olat.sendAdditionalAttributesWithRestriction=false
sebserver.webservice.lms.address.alias=
sebserver.webservice.lms.datafetch.validity.seconds=600