use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method extraTimeAssessmentTestSession.
@Override
public void extraTimeAssessmentTestSession(AssessmentTestSession session, int extraTime, Identity actor) {
testSessionDao.extraTime(session, extraTime);
// commit before event
dbInstance.commit();
AssessmentSessionAuditLogger candidateAuditLogger = getAssessmentSessionAuditLogger(session, false);
candidateAuditLogger.logTestExtend(session, extraTime, actor);
RetrieveAssessmentTestSessionEvent event = new RetrieveAssessmentTestSessionEvent(session.getKey());
OLATResourceable sessionOres = OresHelper.createOLATResourceableInstance(AssessmentTestSession.class, session.getKey());
coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(event, sessionOres);
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method deleteAuthorAssessmentTestSession.
@Override
public boolean deleteAuthorAssessmentTestSession(RepositoryEntryRef testEntry) {
log.audit("Delete author assessment sessions for test: " + testEntry);
List<AssessmentTestSession> sessions = testSessionDao.getAuthorAssessmentTestSession(testEntry);
for (AssessmentTestSession session : sessions) {
File fileStorage = testSessionDao.getSessionStorage(session);
testSessionDao.deleteTestSession(session);
FileUtils.deleteDirsAndFiles(fileStorage, true, true);
}
// make sure it's flushed on the database
dbInstance.commit();
return true;
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method recalculateAssessmentTestSessionScores.
@Override
public AssessmentTestSession recalculateAssessmentTestSessionScores(Long sessionKey) {
dbInstance.commit();
// fresh and lock by the identity assessmentItem controller
AssessmentTestSession candidateSession = getAssessmentTestSession(sessionKey);
BigDecimal totalScore = BigDecimal.valueOf(0l);
BigDecimal totalManualScore = BigDecimal.valueOf(0l);
List<AssessmentItemSession> itemResults = itemSessionDao.getAssessmentItemSessions(candidateSession);
for (AssessmentItemSession itemResult : itemResults) {
if (itemResult.getManualScore() != null) {
totalManualScore = totalManualScore.add(itemResult.getManualScore());
} else if (itemResult.getScore() != null) {
totalScore = totalScore.add(itemResult.getScore());
}
}
candidateSession.setScore(totalScore);
candidateSession.setManualScore(totalManualScore);
return testSessionDao.update(candidateSession);
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method pullSession.
@Override
public AssessmentTestSession pullSession(AssessmentTestSession session, DigitalSignatureOptions signatureOptions, Identity actor) {
session = getAssessmentTestSession(session.getKey());
if (session.getFinishTime() == null) {
if (qtiModule.isDigitalSignatureEnabled()) {
signAssessmentResult(session, signatureOptions, session.getIdentity());
}
session.setFinishTime(new Date());
}
session.setTerminationTime(new Date());
session = updateAssessmentTestSession(session);
// make sure that the changes committed before sending the event
dbInstance.commit();
AssessmentSessionAuditLogger candidateAuditLogger = getAssessmentSessionAuditLogger(session, false);
candidateAuditLogger.logTestRetrieved(session, actor);
OLATResourceable sessionOres = OresHelper.createOLATResourceableInstance(AssessmentTestSession.class, session.getKey());
coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new RetrieveAssessmentTestSessionEvent(session.getKey()), sessionOres);
return session;
}
use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.
the class QTI21ServiceImpl method deleteAssessmentTestSession.
@Override
public boolean deleteAssessmentTestSession(List<Identity> identities, RepositoryEntryRef testEntry, RepositoryEntryRef entry, String subIdent) {
Set<AssessmentEntry> entries = new HashSet<>();
for (Identity identity : identities) {
List<AssessmentTestSession> sessions = testSessionDao.getTestSessions(testEntry, entry, subIdent, identity);
for (AssessmentTestSession session : sessions) {
if (session.getAssessmentEntry() != null) {
entries.add(session.getAssessmentEntry());
}
File fileStorage = testSessionDao.getSessionStorage(session);
testSessionDao.deleteTestSession(session);
FileUtils.deleteDirsAndFiles(fileStorage, true, true);
}
}
for (AssessmentEntry assessmentEntry : entries) {
assessmentEntryDao.resetAssessmentEntry(assessmentEntry);
}
return true;
}
Aggregations