Merge remote-tracking branch 'origin/patch-1.0.2' into development
This commit is contained in:
commit
7c5a2da59d
2 changed files with 14 additions and 0 deletions
|
@ -112,6 +112,18 @@ public class ExamSessionCacheService {
|
|||
return exam;
|
||||
}
|
||||
|
||||
@CacheEvict(
|
||||
cacheNames = CACHE_NAME_RUNNING_EXAM,
|
||||
key = "#examId")
|
||||
public Long evict(final Long examId) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Conditional eviction of running Exam from cache: {}", examId);
|
||||
}
|
||||
|
||||
return examId;
|
||||
}
|
||||
|
||||
public boolean isRunning(final Exam exam) {
|
||||
if (exam == null) {
|
||||
return false;
|
||||
|
|
|
@ -226,8 +226,10 @@ public class ExamSessionServiceImpl implements ExamSessionService {
|
|||
|
||||
@Override
|
||||
public Result<Collection<Exam>> getRunningExamsForInstitution(final Long institutionId) {
|
||||
// NOTE: we evict the exam from the cache (if present) to ensure user is seeing always the current state of the Exam
|
||||
return this.examDAO.allIdsOfInstitution(institutionId)
|
||||
.map(col -> col.stream()
|
||||
.map(this.examSessionCacheService::evict)
|
||||
.map(this::getRunningExam)
|
||||
.filter(Result::hasValue)
|
||||
.map(Result::get)
|
||||
|
|
Loading…
Reference in a new issue