Search in sources :

Example 6 with CandidateTestEventType

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

the class AssessmentTestDisplayController method processEndTestPart.

// public CandidateSession endCurrentTestPart(final CandidateSessionContext candidateSessionContext)
private void processEndTestPart(UserRequest ureq) {
    /* Update state */
    final Date requestTimestamp = ureq.getRequestTimestamp();
    testSessionController.endCurrentTestPart(requestTimestamp);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    TestPlanNode nextTestPart = testSessionController.findNextEnterableTestPart();
    // Record current result state
    final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, nextTestPart == null);
    if (nextTestPart == null) {
        candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, requestTimestamp, getDigitalSignatureOptions(), getIdentity());
        if (!qtiWorksCtrl.willShowSomeAssessmentTestFeedbacks()) {
            // need feedback, no more parts, quickly exit
            try {
                // end current test part
                testSessionController.enterNextAvailableTestPart(requestTimestamp);
            } 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;
            }
            // exit the test
            NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
            CandidateTestEventType eventType = CandidateTestEventType.EXIT_TEST;
            testSessionController.exitTest(requestTimestamp);
            candidateSession.setTerminationTime(requestTimestamp);
            candidateSession = qtiService.updateAssessmentTestSession(candidateSession);
            /* Record and log event */
            final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, eventType, testSessionState, notificationRecorder);
            candidateAuditLogger.logCandidateEvent(candidateTestEvent);
            this.lastEvent = candidateTestEvent;
            qtiWorksCtrl.updateStatusAndResults(ureq);
            doExitTest(ureq);
        }
    } else if (!qtiWorksCtrl.willShowSomeTestPartFeedbacks()) {
        // no feedback, go to the next part
        processAdvanceTestPart(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) AssessmentResult(uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult) Date(java.util.Date) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 7 with CandidateTestEventType

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

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 8 with CandidateTestEventType

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

the class AssessmentTestComponentRenderer method renderTestEvent.

private void renderTestEvent(TestSessionController testSessionController, AssessmentRenderer renderer, StringOutput target, AssessmentTestComponent component, URLBuilder ubu, Translator translator) {
    CandidateSessionContext candidateSessionContext = component.getCandidateSessionContext();
    CandidateEvent candidateEvent = candidateSessionContext.getLastEvent();
    CandidateTestEventType testEventType = candidateEvent.getTestEventType();
    /* If session has terminated, render appropriate state and exit */
    final TestSessionState testSessionState = testSessionController.getTestSessionState();
    if (candidateSessionContext.isTerminated() || testSessionState.isExited()) {
        renderTerminated(target, translator);
    } else if (testEventType == CandidateTestEventType.REVIEW_ITEM) {
        renderer.setReviewMode(true);
        TestPlanNodeKey itemKey = extractTargetItemKey(candidateEvent);
        RenderingRequest options = RenderingRequest.getItemReview();
        renderTestItem(renderer, target, component, itemKey, ubu, translator, options);
    } else if (testEventType == CandidateTestEventType.SOLUTION_ITEM) {
        renderer.setSolutionMode(true);
        TestPlanNodeKey itemKey = extractTargetItemKey(candidateEvent);
        RenderingRequest options = RenderingRequest.getItemSolution();
        renderTestItem(renderer, target, component, itemKey, ubu, translator, options);
    } else {
        /* Render current state */
        final TestPlanNodeKey currentTestPartKey = testSessionState.getCurrentTestPartKey();
        if (testSessionState.isEnded()) {
            /* At end of test, so show overall test feedback */
            renderTestPartFeedback(renderer, target, component, ubu, translator);
        } else if (currentTestPartKey != null) {
            final TestPartSessionState currentTestPartSessionState = testSessionState.getTestPartSessionStates().get(currentTestPartKey);
            final TestPlanNodeKey currentItemKey = testSessionState.getCurrentItemKey();
            if (currentItemKey != null) {
                /* An item is selected, so render it in appropriate state */
                RenderingRequest options = RenderingRequest.getItem(testSessionController);
                renderTestItem(renderer, target, component, currentItemKey, ubu, translator, options);
            } else {
                /* No item selected */
                if (currentTestPartSessionState.isEnded()) {
                    /* testPart has ended, so must be showing testPart feedback */
                    renderTestPartFeedback(renderer, target, component, ubu, translator);
                } else {
                    /* testPart not ended, so we must be showing the navigation menu in nonlinear mode */
                    renderNavigation(renderer, target, component, ubu, translator);
                }
            }
        } else {
            /* No current testPart == start of multipart test */
            renderTestEntry(target, component, translator);
        }
    }
}
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) TestPartSessionState(uk.ac.ed.ph.jqtiplus.state.TestPartSessionState) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 9 with CandidateTestEventType

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

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 10 with CandidateTestEventType

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

the class AssessmentTestDisplayController method processEndTestPart.

// public CandidateSession endCurrentTestPart(final CandidateSessionContext candidateSessionContext)
private void processEndTestPart(UserRequest ureq) {
    /* Update state */
    final Date requestTimestamp = ureq.getRequestTimestamp();
    testSessionController.endCurrentTestPart(requestTimestamp);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    TestPlanNode nextTestPart = testSessionController.findNextEnterableTestPart();
    // Record current result state
    final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, nextTestPart == null);
    if (nextTestPart == null) {
        candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, requestTimestamp, getDigitalSignatureOptions(), getIdentity());
        if (!qtiWorksCtrl.willShowSomeAssessmentTestFeedbacks()) {
            // need feedback, no more parts, quickly exit
            try {
                // end current test part
                testSessionController.enterNextAvailableTestPart(requestTimestamp);
            } 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;
            }
            // exit the test
            NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
            CandidateTestEventType eventType = CandidateTestEventType.EXIT_TEST;
            testSessionController.exitTest(requestTimestamp);
            candidateSession.setTerminationTime(requestTimestamp);
            candidateSession = qtiService.updateAssessmentTestSession(candidateSession);
            /* Record and log event */
            final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, eventType, testSessionState, notificationRecorder);
            candidateAuditLogger.logCandidateEvent(candidateTestEvent);
            this.lastEvent = candidateTestEvent;
            qtiWorksCtrl.updateStatusAndResults(ureq);
            doExitTest(ureq);
        }
    } else if (!qtiWorksCtrl.willShowSomeTestPartFeedbacks()) {
        // no feedback, go to the next part
        processAdvanceTestPart(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) 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