generate proper exam url using updated OLAT api

This commit is contained in:
Carol Alexandru 2021-07-28 22:47:49 +02:00
parent cdd393aecd
commit ae5149226a
2 changed files with 13 additions and 11 deletions

View file

@ -252,7 +252,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
final List<AssessmentData> as = this.apiGetList(restTemplate, url, new ParameterizedTypeReference<List<AssessmentData>>(){});
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<String, String>()))
.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<String, String>());
}

View file

@ -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;