code cleanup
This commit is contained in:
parent
88ff9511f2
commit
17c46362a3
2 changed files with 1 additions and 91 deletions
|
@ -107,8 +107,6 @@ public class ExamSessionControlTask implements DisposableBean {
|
|||
|
||||
controlExamLMSUpdate();
|
||||
controlExamState(updateId);
|
||||
// controlExamStart(updateId);
|
||||
// controlExamEnd(updateId);
|
||||
this.examDAO.releaseAgedLocks();
|
||||
}
|
||||
|
||||
|
@ -215,58 +213,6 @@ public class ExamSessionControlTask implements DisposableBean {
|
|||
}
|
||||
}
|
||||
|
||||
// @Deprecated
|
||||
// private void controlExamStart(final String updateId) {
|
||||
// if (log.isTraceEnabled()) {
|
||||
// log.trace("Check starting exams: {}", updateId);
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// final DateTime now = DateTime.now(DateTimeZone.UTC);
|
||||
// final Map<Long, String> updated = this.examDAO.allForRunCheck()
|
||||
// .getOrThrow()
|
||||
// .stream()
|
||||
// .filter(exam -> exam.startTime != null && exam.startTime.minus(this.examTimePrefix).isBefore(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));
|
||||
//
|
||||
// if (!updated.isEmpty()) {
|
||||
// log.info("Updated exams to running state: {}", updated);
|
||||
// }
|
||||
//
|
||||
// } catch (final Exception e) {
|
||||
// log.error("Unexpected error while trying to update exams: ", e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Deprecated
|
||||
// private void controlExamEnd(final String updateId) {
|
||||
// if (log.isTraceEnabled()) {
|
||||
// log.trace("Check ending exams: {}", updateId);
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// final DateTime now = DateTime.now(DateTimeZone.UTC);
|
||||
//
|
||||
// final Map<Long, String> updated = this.examDAO.allForEndCheck()
|
||||
// .getOrThrow()
|
||||
// .stream()
|
||||
// .filter(exam -> exam.endTime != null && exam.endTime.plus(this.examTimeSuffix).isBefore(now))
|
||||
// .flatMap(exam -> Result.skipOnError(this.examUpdateHandler.setFinished(exam, updateId)))
|
||||
// .collect(Collectors.toMap(Exam::getId, Exam::getName));
|
||||
//
|
||||
// if (!updated.isEmpty()) {
|
||||
// log.info("Updated exams to finished state: {}", updated);
|
||||
// }
|
||||
//
|
||||
// } catch (final Exception e) {
|
||||
// log.error("Unexpected error while trying to update exams: ", e);
|
||||
// }
|
||||
// }
|
||||
|
||||
private void updateMaster() {
|
||||
this.webserviceInfo.updateMaster();
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ class ExamUpdateHandler {
|
|||
this.lmsAPIService
|
||||
.getLmsAPITemplate(lmsSetupId)
|
||||
.map(template -> {
|
||||
// TODO flush only involved courses from cache!
|
||||
template.clearCourseCache();
|
||||
return template;
|
||||
})
|
||||
|
@ -213,43 +214,6 @@ class ExamUpdateHandler {
|
|||
exam,
|
||||
error));
|
||||
}
|
||||
|
||||
// switch (exam.status) {
|
||||
// case UP_COMING: {
|
||||
// // move to RUNNING when now is within the running time frame
|
||||
// if (withinTimeframe(exam.startTime, startTimeThreshold, exam.endTime, endTimeThreshold)) {
|
||||
// setRunning(exam, updateId)
|
||||
// .onError(error -> log.error("Failed to update exam to running state: {}", exam, error));
|
||||
// break;
|
||||
// }
|
||||
// // move to FINISHED when now is behind the end date
|
||||
// if (exam.endTime != null && endTimeThreshold.isAfter(exam.endTime)) {
|
||||
// setFinished(exam, updateId)
|
||||
// .onError(
|
||||
// error -> log.error("Failed to update exam to finished state: {}", exam, error));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// case RUNNING: {
|
||||
// // move to FINISHED when now is behind the end date
|
||||
// if (exam.endTime != null && endTimeThreshold.isAfter(exam.endTime)) {
|
||||
// setFinished(exam, updateId)
|
||||
// .onError(
|
||||
// error -> log.error("Failed to update exam to finished state: {}", exam, error));
|
||||
// break;
|
||||
// }
|
||||
// // move to UP_COMMING when now is before the start date
|
||||
// break;
|
||||
// }
|
||||
// case FINISHED: {
|
||||
// // move to RUNNING when now is within the running time frame
|
||||
// // move to UP_COMMING when now is before the start date
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// log.warn("Exam for status update in unexpected state. Skip update. Exam: {}", exam);
|
||||
// }
|
||||
// }
|
||||
} catch (final Exception e) {
|
||||
log.error("Unexpected error while trying to update exam state for exam: {}", exam, e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue