SEBSERV-175 implemented

This commit is contained in:
anhefti 2021-09-30 11:27:53 +02:00
parent 177d448e08
commit d0407645d8
3 changed files with 18 additions and 9 deletions

View file

@ -21,6 +21,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -94,6 +95,7 @@ public class MoodleCourseAccess extends AbstractCourseAccess {
private final MoodleRestTemplateFactory moodleRestTemplateFactory; private final MoodleRestTemplateFactory moodleRestTemplateFactory;
private final MoodleCourseDataAsyncLoader moodleCourseDataAsyncLoader; private final MoodleCourseDataAsyncLoader moodleCourseDataAsyncLoader;
private final CircuitBreaker<List<QuizData>> allQuizzesRequest; private final CircuitBreaker<List<QuizData>> allQuizzesRequest;
private final boolean prependShortCourseName;
private MoodleAPIRestTemplate restTemplate; private MoodleAPIRestTemplate restTemplate;
@ -122,6 +124,10 @@ public class MoodleCourseAccess extends AbstractCourseAccess {
"sebserver.webservice.circuitbreaker.allQuizzesRequest.timeToRecover", "sebserver.webservice.circuitbreaker.allQuizzesRequest.timeToRecover",
Long.class, Long.class,
Constants.MINUTE_IN_MILLIS)); Constants.MINUTE_IN_MILLIS));
this.prependShortCourseName = BooleanUtils.toBoolean(environment.getProperty(
"sebserver.webservice.lms.moodle.prependShortCourseName",
Constants.TRUE_STRING));
} }
APITemplateDataSupplier getApiTemplateDataSupplier() { APITemplateDataSupplier getApiTemplateDataSupplier() {
@ -648,7 +654,9 @@ public class MoodleCourseAccess extends AbstractCourseAccess {
lmsSetup.getInstitutionId(), lmsSetup.getInstitutionId(),
lmsSetup.id, lmsSetup.id,
lmsSetup.getLmsType(), lmsSetup.getLmsType(),
courseQuizData.name, (this.prependShortCourseName)
? courseData.short_name + " : " + courseQuizData.name
: courseQuizData.name,
Constants.EMPTY_NOTE, Constants.EMPTY_NOTE,
(courseQuizData.time_open != null && courseQuizData.time_open > 0) (courseQuizData.time_open != null && courseQuizData.time_open > 0)
? Utils.toDateTimeUTCUnix(courseQuizData.time_open) ? Utils.toDateTimeUTCUnix(courseQuizData.time_open)

View file

@ -65,6 +65,7 @@ sebserver.webservice.api.pagination.maxPageSize=500
# comma separated list of known possible OpenEdX API access token request endpoints # comma separated list of known possible OpenEdX API access token request endpoints
sebserver.webservice.lms.openedx.api.token.request.paths=/oauth2/access_token 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.api.token.request.paths=/login/token.php
sebserver.webservice.lms.moodle.prependShortCourseName=true
sebserver.webservice.lms.address.alias= sebserver.webservice.lms.address.alias=
sebserver.webservice.proctoring.resetBroadcastOnLeav=true sebserver.webservice.proctoring.resetBroadcastOnLeav=true

View file

@ -404,16 +404,16 @@ sebserver.quizdiscovery.quiz.details.url=Start URL
sebserver.quizdiscovery.quiz.details.url.tooltip=The start URL on the LMS for the exam<br/><br/>This is defined by the LMS setup and the exam URL sebserver.quizdiscovery.quiz.details.url.tooltip=The start URL on the LMS for the exam<br/><br/>This is defined by the LMS setup and the exam URL
sebserver.quizdiscovery.quiz.details.additional.timecreated=Creation Time sebserver.quizdiscovery.quiz.details.additional.timecreated=Creation Time
sebserver.quizdiscovery.quiz.details.additional.timecreated.tooltip=The time when the LMS exam was first created<br/><br/>This time is defined by the corresponding LMS sebserver.quizdiscovery.quiz.details.additional.timecreated.tooltip=The time when the LMS exam was first created<br/><br/>This time is defined by the corresponding LMS
sebserver.quizdiscovery.quiz.details.additional.course_shortname=Short Name sebserver.quizdiscovery.quiz.details.additional.course_short_name=Short Name
sebserver.quizdiscovery.quiz.details.additional.course_shortname.tooltip=The short name of the LMS exam<br/><br/>This is defined on the corresponding LMS sebserver.quizdiscovery.quiz.details.additional.course_short_name.tooltip=The short name of the LMS exam<br/><br/>This is defined on the corresponding LMS
sebserver.quizdiscovery.quiz.details.additional.course_fullname=Full Name sebserver.quizdiscovery.quiz.details.additional.course_full_name=Full Name
sebserver.quizdiscovery.quiz.details.additional.course_fullname.tooltip=The full name of the LMS exam<br/><br/>This is defined on the corresponding LMS sebserver.quizdiscovery.quiz.details.additional.course_full_name.tooltip=The full name of the LMS exam<br/><br/>This is defined on the corresponding LMS
sebserver.quizdiscovery.quiz.details.additional.course_displayname=Display Name sebserver.quizdiscovery.quiz.details.additional.course_display_name=Display Name
sebserver.quizdiscovery.quiz.details.additional.course_displayname.tooltip=The display name of the LMS exam<br/><br/>This is defined on the corresponding LMS sebserver.quizdiscovery.quiz.details.additional.course_display_name.tooltip=The display name of the LMS exam<br/><br/>This is defined on the corresponding LMS
sebserver.quizdiscovery.quiz.details.additional.course_summary=Summary sebserver.quizdiscovery.quiz.details.additional.course_summary=Summary
sebserver.quizdiscovery.quiz.details.additional.course_summary.tooltip=The summary of the LMS exam<br/><br/>This is defined on the corresponding LMS sebserver.quizdiscovery.quiz.details.additional.course_summary.tooltip=The summary of the LMS exam<br/><br/>This is defined on the corresponding LMS
sebserver.quizdiscovery.quiz.details.additional.timelimit=Time Limit sebserver.quizdiscovery.quiz.details.additional.time_limit=Time Limit
sebserver.quizdiscovery.quiz.details.additional.timelimit.toolitp=The time limit of the LMS exam<br/><br/>This is defined on the corresponding LMS sebserver.quizdiscovery.quiz.details.additional.time_limit.toolitp=The time limit of the LMS exam<br/><br/>This is defined on the corresponding LMS
################################ ################################
# Exam # Exam