Merge branch 'dev-1.6' into development

This commit is contained in:
anhefti 2024-03-26 09:50:20 +01:00
commit 68d367d1fb
3 changed files with 36 additions and 12 deletions

View file

@ -148,9 +148,12 @@ public class SEBRestrictionServiceImpl implements SEBRestrictionService {
// special Moodle plugin case for ADDITIONAL_ATTR_ALTERNATIVE_SEB_BEK // special Moodle plugin case for ADDITIONAL_ATTR_ALTERNATIVE_SEB_BEK
this.lmsAPIService.getLmsSetup(exam.lmsSetupId).map(lms -> { this.lmsAPIService.getLmsSetup(exam.lmsSetupId).map(lms -> {
if (lms.lmsType == LmsType.MOODLE_PLUGIN) { if (lms.lmsType == LmsType.MOODLE_PLUGIN) {
additionalAttributes.put( final AdditionalAttributeRecord attr = this.additionalAttributesDAO.getAdditionalAttribute(
MoodleSEBRestriction.ATTR_ALT_BEK, EntityType.EXAM,
exam.getAdditionalAttribute(ADDITIONAL_ATTR_ALTERNATIVE_SEB_BEK)); exam.id,
ADDITIONAL_ATTR_ALTERNATIVE_SEB_BEK)
.getOrThrow();
additionalAttributes.put(MoodleSEBRestriction.ATTR_ALT_BEK, attr.getValue());
} }
return lms; return lms;
}); });

View file

@ -202,18 +202,36 @@ public abstract class MoodleUtils {
final boolean useQuizId) { final boolean useQuizId) {
final Map<String, String> additionalAttrs = new HashMap<>(); final Map<String, String> additionalAttrs = new HashMap<>();
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_CREATION_TIME, String.valueOf(courseData.time_created)); if (courseData.time_created != null) {
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_SHORT_NAME, courseData.short_name); additionalAttrs.put(QuizData.ATTR_ADDITIONAL_CREATION_TIME, String.valueOf(courseData.time_created));
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_ID_NUMBER, courseData.idnumber); }
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_FULL_NAME, courseData.full_name); if (courseData.short_name != null) {
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_DISPLAY_NAME, courseData.display_name); additionalAttrs.put(QuizData.ATTR_ADDITIONAL_SHORT_NAME, courseData.short_name);
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_SUMMARY, courseData.summary); }
if (courseData.idnumber != null) {
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_ID_NUMBER, courseData.idnumber);
}
if (StringUtils.isNotBlank(courseData.full_name)) {
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_FULL_NAME, courseData.full_name);
}
if (StringUtils.isNotBlank(courseData.display_name)) {
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_DISPLAY_NAME, courseData.display_name);
}
if (StringUtils.isNotBlank(courseData.summary)) {
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_SUMMARY, courseData.summary);
}
final List<QuizData> courseAndQuiz = courseData.quizzes final List<QuizData> courseAndQuiz = courseData.quizzes
.stream() .stream()
.map(courseQuizData -> { .map(courseQuizData -> {
final String startURI = uriPrefix + courseQuizData.course_module; final String startURI = uriPrefix + courseQuizData.course_module;
additionalAttrs.put(QuizData.ATTR_ADDITIONAL_TIME_LIMIT, String.valueOf(courseQuizData.time_limit));
additionalAttrs.put(
QuizData.ATTR_ADDITIONAL_TIME_LIMIT,
(courseQuizData.time_limit == null)
? StringUtils.EMPTY
: String.valueOf(courseQuizData.time_limit));
return new QuizData( return new QuizData(
MoodleUtils.getInternalQuizId( MoodleUtils.getInternalQuizId(
(useQuizId) ? courseQuizData.id : courseQuizData.course_module, (useQuizId) ? courseQuizData.id : courseQuizData.course_module,

View file

@ -137,8 +137,11 @@ public class MoodlePluginCourseRestriction implements SEBRestrictionAPI {
final ArrayList<String> configKeys = new ArrayList<>(sebRestrictionData.configKeys); final ArrayList<String> configKeys = new ArrayList<>(sebRestrictionData.configKeys);
final String quitLink = this.examConfigurationValueService.getQuitLink(exam.id); final String quitLink = this.examConfigurationValueService.getQuitLink(exam.id);
final String quitSecret = this.examConfigurationValueService.getQuitPassword(exam.id); final String quitSecret = this.examConfigurationValueService.getQuitPassword(exam.id);
final String additionalBEK = exam.getAdditionalAttribute( String additionalBEK = sebRestrictionData.additionalProperties.get(SEBRestrictionService.ADDITIONAL_ATTR_ALTERNATIVE_SEB_BEK);
SEBRestrictionService.ADDITIONAL_ATTR_ALTERNATIVE_SEB_BEK); if (additionalBEK == null) {
additionalBEK = exam.getAdditionalAttribute(
SEBRestrictionService.ADDITIONAL_ATTR_ALTERNATIVE_SEB_BEK);
}
if (additionalBEK != null && !beks.contains(additionalBEK)) { if (additionalBEK != null && !beks.contains(additionalBEK)) {
beks.add(additionalBEK); beks.add(additionalBEK);