From ae5149226a5fddebef4cf908963f430eb83fbea9 Mon Sep 17 00:00:00 2001 From: Carol Alexandru Date: Wed, 28 Jul 2021 22:47:49 +0200 Subject: [PATCH] generate proper exam url using updated OLAT api --- .../lms/impl/olat/OlatLmsAPITemplate.java | 8 ++++---- .../servicelayer/lms/impl/olat/OlatLmsData.java | 16 +++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java index 98d1da1e..70f38b23 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java @@ -252,7 +252,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm final List as = this.apiGetList(restTemplate, url, new ParameterizedTypeReference>(){}); return as.stream() .map(a -> new QuizData( - String.format("%d", a.key), + String.format("%d", a.assessmentModeKey), lmsSetup.getInstitutionId(), lmsSetup.id, lmsSetup.getLmsType(), @@ -260,7 +260,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm a.description, Utils.toDateTimeUTC(a.dateFrom), Utils.toDateTimeUTC(a.dateTo), - examUrl(a.key), + examUrl(a.repositoryEntryKey), new HashMap())) .collect(Collectors.toList()); } @@ -283,7 +283,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm final String url = String.format("/restapi/assessment_modes/%s", id); final AssessmentData a = this.apiGet(restTemplate, url, AssessmentData.class); return new QuizData( - String.format("%d", a.key), + String.format("%d", a.assessmentModeKey), lmsSetup.getInstitutionId(), lmsSetup.id, lmsSetup.getLmsType(), @@ -291,7 +291,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm a.description, Utils.toDateTimeUTC(a.dateFrom), Utils.toDateTimeUTC(a.dateTo), - examUrl(a.key), + examUrl(a.repositoryEntryKey), new HashMap()); } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsData.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsData.java index 9fe7b961..5698080b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsData.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsData.java @@ -19,15 +19,17 @@ public final class OlatLmsData { static public final class AssessmentData { /* OLAT API example: { - "key":7405568, - "name":"Test1", - "description":"", - "courseName":"test", - "dateFrom":1626515100000, - "dateTo":1626523260000 + "courseName": "course 1", + "dateFrom": 1624420800000, + "dateTo": 1624658400000, + "description": "", + "assessmentModeKey": 6356992, + “repositoryEntryKey”: 462324, + "name": "SEB test" } */ - public long key; + public long assessmentModeKey; + public long repositoryEntryKey; public String name; public String description; public String courseName;