SEBSERV-332
This commit is contained in:
parent
38037539db
commit
335cab3783
5 changed files with 24 additions and 6 deletions
2
pom.xml
2
pom.xml
|
@ -18,7 +18,7 @@
|
|||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<sebserver-version>1.4-rc1</sebserver-version>
|
||||
<sebserver-version>1.4.0-SNAPSHOT</sebserver-version>
|
||||
<build-version>${sebserver-version}</build-version>
|
||||
<revision>${sebserver-version}</revision>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
|
|
@ -11,6 +11,7 @@ package ch.ethz.seb.sebserver.gbl.model.session;
|
|||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import ch.ethz.seb.sebserver.gbl.Constants;
|
||||
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
|
||||
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup.LmsType;
|
||||
|
||||
|
@ -47,7 +48,7 @@ public final class RunningExamInfo {
|
|||
this.examId = exam.getModelId();
|
||||
this.name = exam.name;
|
||||
this.url = exam.getStartURL();
|
||||
this.lmsType = (lmsType == null) ? "" : lmsType.name();
|
||||
this.lmsType = (lmsType == null) ? Constants.EMPTY_NOTE : lmsType.name();
|
||||
}
|
||||
|
||||
public String getExamId() {
|
||||
|
|
|
@ -648,6 +648,9 @@ public class ExamDAOImpl implements ExamDAO {
|
|||
.and(
|
||||
ExamRecordDynamicSqlSupport.status,
|
||||
isEqualTo(ExamStatus.RUNNING.name()))
|
||||
.and(
|
||||
ExamRecordDynamicSqlSupport.lmsAvailable,
|
||||
isEqualToWhenPresent(BooleanUtils.toIntegerObject(true)))
|
||||
.build()
|
||||
.execute());
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ public class ExamAPI_V1_Controller {
|
|||
.getOrThrow()
|
||||
.stream()
|
||||
.map(this::createRunningExamInfo)
|
||||
.filter(this::checkConsistency)
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
final Exam exam = this.examSessionService.getExamDAO()
|
||||
|
@ -158,6 +159,18 @@ public class ExamAPI_V1_Controller {
|
|||
this.executor);
|
||||
}
|
||||
|
||||
private boolean checkConsistency(final RunningExamInfo info) {
|
||||
if (StringUtils.isNotBlank(info.name) &&
|
||||
StringUtils.isNotBlank(info.url) &&
|
||||
StringUtils.isNotBlank(info.examId)) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
log.warn("Invalid running exam detected. Filter out exam : {}", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
path = API.EXAM_API_HANDSHAKE_ENDPOINT,
|
||||
method = RequestMethod.PATCH,
|
||||
|
|
|
@ -9,13 +9,14 @@ INSERT IGNORE INTO seb_client_configuration VALUES
|
|||
|
||||
INSERT IGNORE INTO additional_attributes VALUES
|
||||
(1, 'SEB_CLIENT_CONFIGURATION', 2, 'vdiSetup', 'VM_WARE'),
|
||||
(2, 'SEB_CLIENT_CONFIGURATION', 2, 'vdiExecutable', 'vmware-view.exe')
|
||||
(2, 'SEB_CLIENT_CONFIGURATION', 2, 'vdiExecutable', 'vmware-view.exe'),
|
||||
(3, 'EXAM', 2, 'quiz_start_url', 'https://test.lms.mockup')
|
||||
;
|
||||
|
||||
INSERT IGNORE INTO exam VALUES
|
||||
(1, 1, 1, 'quiz1', 'admin', 'admin', 'MANAGED', null, null, 'UP_COMING', 1, 0, null, 1, null, null, null, null, null, null),
|
||||
(2, 1, 1, 'quiz6', 'admin', 'admin', 'MANAGED', null, null, 'RUNNING', 1, 0, null, 1, null, null, null, null, null, null),
|
||||
(3, 1, 1, 'quiz3', 'admin', 'admin', 'MANAGED', null, null, 'FINISHED', 1, 0, null, 1, null, null, null, null, null, null)
|
||||
(1, 1, 1, 'quiz1', 'admin', 'admin', 'MANAGED', null, null, 'UP_COMING', 1, 0, null, 1, null, null, 'quiz1', null, null, 1),
|
||||
(2, 1, 1, 'quiz6', 'admin', 'admin', 'MANAGED', null, null, 'RUNNING', 1, 0, null, 1, null, null, 'quiz6', null, null, 1),
|
||||
(3, 1, 1, 'quiz3', 'admin', 'admin', 'MANAGED', null, null, 'FINISHED', 1, 0, null, 1, null, null, 'quiz3', null, null, 1)
|
||||
;
|
||||
|
||||
INSERT IGNORE INTO indicator VALUES
|
||||
|
|
Loading…
Reference in a new issue