Search in sources :

Example 1 with CandidateTestEventType

use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project OpenOLAT by OpenOLAT.

the class AssessmentTreeComponentRenderer method renderTestEvent.

private void renderTestEvent(TestSessionController testSessionController, AssessmentRenderer renderer, StringOutput target, AssessmentTreeComponent component, URLBuilder ubu, Translator translator, RenderingRequest options) {
    CandidateSessionContext candidateSessionContext = component.getCandidateSessionContext();
    CandidateEvent candidateEvent = candidateSessionContext.getLastEvent();
    CandidateTestEventType testEventType = candidateEvent.getTestEventType();
    final TestSessionState testSessionState = testSessionController.getTestSessionState();
    if (!candidateSessionContext.isTerminated() && !testSessionState.isExited()) {
        if (testEventType == CandidateTestEventType.REVIEW_ITEM) {
            renderer.setReviewMode(true);
        } else if (testEventType == CandidateTestEventType.SOLUTION_ITEM) {
            renderer.setSolutionMode(true);
        }
        renderNavigation(renderer, target, component, ubu, translator, options);
    }
}
Also used : CandidateSessionContext(org.olat.ims.qti21.ui.CandidateSessionContext) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) CandidateTestEventType(org.olat.ims.qti21.model.audit.CandidateTestEventType) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 2 with CandidateTestEventType

use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project OpenOLAT by OpenOLAT.

the class QTI21ServiceImpl method recordCandidateTestEvent.

@Override
public CandidateEvent recordCandidateTestEvent(AssessmentTestSession candidateSession, RepositoryEntryRef testEntry, RepositoryEntryRef entry, CandidateTestEventType textEventType, CandidateItemEventType itemEventType, TestPlanNodeKey itemKey, TestSessionState testSessionState, NotificationRecorder notificationRecorder) {
    CandidateEvent event = new CandidateEvent(candidateSession, testEntry, entry);
    event.setTestEventType(textEventType);
    event.setItemEventType(itemEventType);
    if (itemKey != null) {
        event.setTestItemKey(itemKey.toString());
    }
    storeTestSessionState(event, testSessionState);
    return event;
}
Also used : CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 3 with CandidateTestEventType

use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project OpenOLAT by OpenOLAT.

the class AssessmentTestDisplayController method processAdvanceTestPart.

private void processAdvanceTestPart(UserRequest ureq) {
    /* Get current JQTI state and create JQTI controller */
    NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    /* Perform action */
    final TestPlanNode nextTestPart;
    final Date currentTimestamp = ureq.getRequestTimestamp();
    try {
        nextTestPart = testSessionController.enterNextAvailableTestPart(currentTimestamp);
    } catch (final QtiCandidateStateException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_ADVANCE_TEST_PART, e);
        logError("CANNOT_ADVANCE_TEST_PART", e);
        return;
    } catch (final RuntimeException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_ADVANCE_TEST_PART, e);
        logError("RuntimeException", e);
        // handleExplosion(e, candidateSession);
        return;
    }
    CandidateTestEventType eventType;
    if (nextTestPart != null) {
        /* Moved into next test part */
        eventType = CandidateTestEventType.ADVANCE_TEST_PART;
    } else {
        /* No more test parts.
             *
             * For single part tests, we terminate the test completely now as the test feedback was shown with the testPart feedback.
             * For multi-part tests, we shall keep the test open so that the test feedback can be viewed.
             */
        if (testSessionState.getTestPlan().getTestPartNodes().size() == 1) {
            eventType = CandidateTestEventType.EXIT_TEST;
            testSessionController.exitTest(currentTimestamp);
            candidateSession.setTerminationTime(currentTimestamp);
            candidateSession = qtiService.updateAssessmentTestSession(candidateSession);
        } else {
            eventType = CandidateTestEventType.ADVANCE_TEST_PART;
        }
    }
    boolean terminated = isTerminated();
    /* Record current result state */
    computeAndRecordTestAssessmentResult(currentTimestamp, testSessionState, terminated);
    /* Record and log event */
    final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, eventType, testSessionState, notificationRecorder);
    candidateAuditLogger.logCandidateEvent(candidateTestEvent);
    this.lastEvent = candidateTestEvent;
    if (terminated) {
        qtiWorksCtrl.updateStatusAndResults(ureq);
        doExitTest(ureq);
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) QtiCandidateStateException(uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) CandidateTestEventType(org.olat.ims.qti21.model.audit.CandidateTestEventType) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 4 with CandidateTestEventType

use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project openolat by klemens.

the class AssessmentTestDisplayController method processAdvanceTestPart.

private void processAdvanceTestPart(UserRequest ureq) {
    /* Get current JQTI state and create JQTI controller */
    NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    /* Perform action */
    final TestPlanNode nextTestPart;
    final Date currentTimestamp = ureq.getRequestTimestamp();
    try {
        nextTestPart = testSessionController.enterNextAvailableTestPart(currentTimestamp);
    } catch (final QtiCandidateStateException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_ADVANCE_TEST_PART, e);
        logError("CANNOT_ADVANCE_TEST_PART", e);
        return;
    } catch (final RuntimeException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_ADVANCE_TEST_PART, e);
        logError("RuntimeException", e);
        // handleExplosion(e, candidateSession);
        return;
    }
    CandidateTestEventType eventType;
    if (nextTestPart != null) {
        /* Moved into next test part */
        eventType = CandidateTestEventType.ADVANCE_TEST_PART;
    } else {
        /* No more test parts.
             *
             * For single part tests, we terminate the test completely now as the test feedback was shown with the testPart feedback.
             * For multi-part tests, we shall keep the test open so that the test feedback can be viewed.
             */
        if (testSessionState.getTestPlan().getTestPartNodes().size() == 1) {
            eventType = CandidateTestEventType.EXIT_TEST;
            testSessionController.exitTest(currentTimestamp);
            candidateSession.setTerminationTime(currentTimestamp);
            candidateSession = qtiService.updateAssessmentTestSession(candidateSession);
        } else {
            eventType = CandidateTestEventType.ADVANCE_TEST_PART;
        }
    }
    boolean terminated = isTerminated();
    /* Record current result state */
    computeAndRecordTestAssessmentResult(currentTimestamp, testSessionState, terminated);
    /* Record and log event */
    final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, eventType, testSessionState, notificationRecorder);
    candidateAuditLogger.logCandidateEvent(candidateTestEvent);
    this.lastEvent = candidateTestEvent;
    if (terminated) {
        qtiWorksCtrl.updateStatusAndResults(ureq);
        doExitTest(ureq);
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) QtiCandidateStateException(uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) CandidateTestEventType(org.olat.ims.qti21.model.audit.CandidateTestEventType) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 5 with CandidateTestEventType

use of org.olat.ims.qti21.model.audit.CandidateTestEventType in project openolat by klemens.

the class AssessmentTestDisplayController method processFinishLinearItem.

// public CandidateSession finishLinearItem(final CandidateSessionContext candidateSessionContext)
// throws CandidateException {
private void processFinishLinearItem(UserRequest ureq) {
    NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    try {
        if (!testSessionController.mayAdvanceItemLinear()) {
            candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_FINISH_LINEAR_TEST_ITEM, null);
            logError("CANNOT_FINISH_LINEAR_TEST_ITEM", null);
            return;
        }
    } catch (RuntimeException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_FINISH_LINEAR_TEST_ITEM, e);
        logError("CANNOT_FINISH_LINEAR_TEST_ITEM", e);
        return;
    }
    // Update state
    final Date requestTimestamp = ureq.getRequestTimestamp();
    final TestPlanNode nextItemNode = testSessionController.advanceItemLinear(requestTimestamp);
    boolean terminated = nextItemNode == null && testSessionController.findNextEnterableTestPart() == null;
    // Record current result state
    final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, terminated);
    /* If we ended the testPart and there are now no more available testParts, then finish the session now */
    if (terminated) {
        candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, requestTimestamp, getDigitalSignatureOptions(), getIdentity());
    }
    // Record and log event
    final CandidateTestEventType eventType = nextItemNode != null ? CandidateTestEventType.FINISH_ITEM : CandidateTestEventType.FINISH_FINAL_ITEM;
    final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, eventType, null, null, testSessionState, notificationRecorder);
    this.lastEvent = candidateTestEvent;
    candidateAuditLogger.logCandidateEvent(candidateTestEvent);
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) CandidateTestEventType(org.olat.ims.qti21.model.audit.CandidateTestEventType) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) AssessmentResult(uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Aggregations

CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)14 CandidateTestEventType (org.olat.ims.qti21.model.audit.CandidateTestEventType)12 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)10 Date (java.util.Date)6 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)6 CandidateSessionContext (org.olat.ims.qti21.ui.CandidateSessionContext)6 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)6 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)6 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)5 AssessmentResult (uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult)4 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 TestSessionController (uk.ac.ed.ph.jqtiplus.running.TestSessionController)2 TestPartSessionState (uk.ac.ed.ph.jqtiplus.state.TestPartSessionState)2 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)2