SEBSERV-299 fixed for null end-time and added Mockup test quiz11

This commit is contained in:
anhefti 2022-04-27 11:40:54 +02:00
parent 9ed1d96183
commit bc1026a6b7
3 changed files with 11 additions and 4 deletions

View file

@ -130,6 +130,13 @@ public class MockupLmsAPITemplate implements LmsAPITemplate {
DateTime.now(DateTimeZone.UTC).plus(6 * Constants.MINUTE_IN_MILLIS)
.toString(Constants.DEFAULT_DATE_TIME_FORMAT),
"http://lms.mockup.com/api/"));
this.mockups.add(new QuizData(
"quiz11", institutionId, lmsSetupId, lmsType, "Demo Quiz 11 (MOCKUP)",
"Starts in a minute and ends never",
DateTime.now(DateTimeZone.UTC).plus(Constants.MINUTE_IN_MILLIS)
.toString(Constants.DEFAULT_DATE_TIME_FORMAT),
null,
"http://lms.mockup.com/api/"));
}
@Override

View file

@ -161,7 +161,7 @@ public class ExamSessionControlTask implements DisposableBean {
.getOrThrow()
.stream()
.filter(exam -> exam.startTime.minus(this.examTimePrefix).isBefore(now))
.filter(exam -> exam.endTime != null && exam.endTime.plus(this.examTimeSuffix).isAfter(now))
.filter(exam -> exam.endTime == null || exam.endTime.plus(this.examTimeSuffix).isAfter(now))
.flatMap(exam -> Result.skipOnError(this.examUpdateHandler.setRunning(exam, updateId)))
.collect(Collectors.toMap(Exam::getId, Exam::getName));

View file

@ -59,7 +59,7 @@ public class QuizDataTest extends AdministrationAPIIntegrationTester {
});
assertNotNull(quizzes);
assertTrue(quizzes.content.size() == 8);
assertTrue(quizzes.content.size() == 9);
// for the inactive LmsSetup we should'nt get any quizzes
quizzes = new RestAPITestHelper()
@ -109,7 +109,7 @@ public class QuizDataTest extends AdministrationAPIIntegrationTester {
});
assertNotNull(quizzes);
assertTrue(quizzes.content.size() == 8);
assertTrue(quizzes.content.size() == 9);
// but for the now active lmsSetup2 we should get the quizzes
quizzes = new RestAPITestHelper()
@ -120,7 +120,7 @@ public class QuizDataTest extends AdministrationAPIIntegrationTester {
});
assertNotNull(quizzes);
assertTrue(quizzes.content.size() == 8);
assertTrue(quizzes.content.size() == 9);
}
@Test