Search in sources :

Example 6 with AssessmentSessionAuditLogger

use of org.olat.ims.qti21.AssessmentSessionAuditLogger in project openolat by klemens.

the class CorrectionIdentityAssessmentItemController method doSave.

private void doSave() {
    TestSessionState testSessionState = itemCorrection.getTestSessionState();
    AssessmentTestSession candidateSession = itemCorrection.getTestSession();
    try (AssessmentSessionAuditLogger candidateAuditLogger = qtiService.getAssessmentSessionAuditLogger(candidateSession, false)) {
        TestPlanNodeKey testPlanNodeKey = itemCorrection.getItemNode().getKey();
        String stringuifiedIdentifier = testPlanNodeKey.getIdentifier().toString();
        ParentPartItemRefs parentParts = AssessmentTestHelper.getParentSection(testPlanNodeKey, testSessionState, resolvedAssessmentTest);
        AssessmentItemSession itemSession = qtiService.getOrCreateAssessmentItemSession(candidateSession, parentParts, stringuifiedIdentifier);
        itemSession.setManualScore(identityInteractionsCtrl.getManualScore());
        itemSession.setCoachComment(identityInteractionsCtrl.getComment());
        itemSession.setToReview(identityInteractionsCtrl.isToReview());
        itemSession = qtiService.updateAssessmentItemSession(itemSession);
        itemCorrection.setItemSession(itemSession);
        candidateAuditLogger.logCorrection(candidateSession, itemSession, getIdentity());
        candidateSession = qtiService.recalculateAssessmentTestSessionScores(candidateSession.getKey());
        itemCorrection.setTestSession(candidateSession);
        model.updateLastSession(itemCorrection.getAssessedIdentity(), candidateSession);
    } catch (IOException e) {
        logError("", e);
    }
}
Also used : ParentPartItemRefs(org.olat.ims.qti21.model.ParentPartItemRefs) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) AssessmentSessionAuditLogger(org.olat.ims.qti21.AssessmentSessionAuditLogger) IOException(java.io.IOException) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 7 with AssessmentSessionAuditLogger

use of org.olat.ims.qti21.AssessmentSessionAuditLogger 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);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentSessionAuditLogger(org.olat.ims.qti21.AssessmentSessionAuditLogger) RetrieveAssessmentTestSessionEvent(org.olat.ims.qti21.ui.event.RetrieveAssessmentTestSessionEvent)

Example 8 with AssessmentSessionAuditLogger

use of org.olat.ims.qti21.AssessmentSessionAuditLogger 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;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentSessionAuditLogger(org.olat.ims.qti21.AssessmentSessionAuditLogger) RetrieveAssessmentTestSessionEvent(org.olat.ims.qti21.ui.event.RetrieveAssessmentTestSessionEvent) Date(java.util.Date)

Example 9 with AssessmentSessionAuditLogger

use of org.olat.ims.qti21.AssessmentSessionAuditLogger in project openolat by klemens.

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);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentSessionAuditLogger(org.olat.ims.qti21.AssessmentSessionAuditLogger) RetrieveAssessmentTestSessionEvent(org.olat.ims.qti21.ui.event.RetrieveAssessmentTestSessionEvent)

Example 10 with AssessmentSessionAuditLogger

use of org.olat.ims.qti21.AssessmentSessionAuditLogger in project openolat by klemens.

the class QTI21ServiceImpl method getAssessmentSessionAuditLogger.

@Override
public AssessmentSessionAuditLogger getAssessmentSessionAuditLogger(AssessmentTestSession session, boolean authorMode) {
    if (authorMode) {
        return new AssessmentSessionAuditOLog();
    }
    if (session.getIdentity() == null && StringHelper.containsNonWhitespace(session.getAnonymousIdentifier())) {
        return new AssessmentSessionAuditOLog();
    }
    try {
        File auditLog = getAssessmentSessionAuditLogFile(session);
        FileOutputStream outputStream = new FileOutputStream(auditLog, true);
        return new AssessmentSessionAuditFileLog(outputStream);
    } catch (IOException e) {
        log.error("Cannot open the user specific log audit, fall back to OLog", e);
        return new AssessmentSessionAuditOLog();
    }
}
Also used : AssessmentSessionAuditFileLog(org.olat.ims.qti21.manager.audit.AssessmentSessionAuditFileLog) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) AssessmentSessionAuditOLog(org.olat.ims.qti21.manager.audit.AssessmentSessionAuditOLog)

Aggregations

AssessmentSessionAuditLogger (org.olat.ims.qti21.AssessmentSessionAuditLogger)8 OLATResourceable (org.olat.core.id.OLATResourceable)6 RetrieveAssessmentTestSessionEvent (org.olat.ims.qti21.ui.event.RetrieveAssessmentTestSessionEvent)6 IOException (java.io.IOException)4 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)4 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)4 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)4 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)2 AssessmentSessionAuditFileLog (org.olat.ims.qti21.manager.audit.AssessmentSessionAuditFileLog)2 AssessmentSessionAuditOLog (org.olat.ims.qti21.manager.audit.AssessmentSessionAuditOLog)2 InMemoryAssessmentTestSession (org.olat.ims.qti21.model.InMemoryAssessmentTestSession)2 ParentPartItemRefs (org.olat.ims.qti21.model.ParentPartItemRefs)2