Search in sources :

Example 56 with CandidateEvent

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

the class AssessmentTestDisplayController method processSelectItem.

private void processSelectItem(UserRequest ureq, String key) {
    if (checkConcurrentExit(ureq)) {
        return;
    }
    TestPlanNodeKey nodeKey = TestPlanNodeKey.fromString(key);
    Date requestTimestamp = ureq.getRequestTimestamp();
    TestPlanNode selectedNode = testSessionController.selectItemNonlinear(requestTimestamp, nodeKey);
    /* Record and log event */
    TestPlanNodeKey selectedNodeKey = (selectedNode == null ? null : selectedNode.getKey());
    NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    CandidateEvent candidateEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.SELECT_MENU, null, selectedNodeKey, testSessionState, notificationRecorder);
    candidateAuditLogger.logCandidateEvent(candidateEvent);
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) Date(java.util.Date) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 57 with CandidateEvent

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

the class AssessmentTestDisplayController method enterSession.

// private CandidateSession enterCandidateSession(final CandidateSession candidateSession)
private TestSessionController enterSession(UserRequest ureq) {
    /* Set up listener to record any notifications */
    final NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    /* Create fresh JQTI+ state & controller for it */
    testSessionController = createNewTestSessionStateAndController(notificationRecorder);
    if (testSessionController == null) {
        return null;
    }
    /* Initialise test state and enter test */
    final TestSessionState testSessionState = testSessionController.getTestSessionState();
    final Date timestamp = ureq.getRequestTimestamp();
    try {
        testSessionController.initialize(timestamp);
        final int testPartCount = testSessionController.enterTest(timestamp);
        if (testPartCount == 1) {
            /* If there is only testPart, then enter this (if possible).
                 * (Note that this may cause the test to exit immediately if there is a failed
                 * preCondition on this part.)
                 */
            testSessionController.enterNextAvailableTestPart(timestamp);
        } else {
        /* Don't enter first testPart yet - we shall tell candidate that
                 * there are multiple parts and let them enter manually.
                 */
        }
    } catch (final RuntimeException e) {
        logError("", e);
        return null;
    }
    /* Record and log event */
    final CandidateEvent candidateEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.ENTER_TEST, testSessionState, notificationRecorder);
    candidateAuditLogger.logCandidateEvent(candidateEvent);
    this.lastEvent = candidateEvent;
    boolean ended = testSessionState.isEnded();
    /* Record current result state */
    final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(timestamp, testSessionState, ended);
    /* Handle immediate end of test session */
    if (ended) {
        candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, timestamp, getDigitalSignatureOptions(), getIdentity());
    } else {
        TestPart currentTestPart = testSessionController.getCurrentTestPart();
        if (currentTestPart != null && currentTestPart.getNavigationMode() == NavigationMode.NONLINEAR) {
            // go to the first assessment item
            if (testSessionController.hasFollowingNonLinearItem()) {
                testSessionController.selectFollowingItemNonLinear(currentRequestTimestamp);
            }
        }
    }
    return testSessionController;
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) 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 58 with CandidateEvent

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

the class AssessmentTestDisplayController method initOrResumeAssessmentTestSession.

private void initOrResumeAssessmentTestSession(UserRequest ureq, boolean authorMode) {
    AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, anonymousIdentifier, entry, subIdent, testEntry);
    if (outcomesListener == null) {
        boolean manualCorrections = AssessmentTestHelper.needManualCorrection(resolvedAssessmentTest);
        outcomesListener = new AssessmentEntryOutcomesListener(entry, testEntry, assessmentEntry, manualCorrections, assessmentService, authorMode);
    }
    AssessmentTestSession lastSession = qtiService.getResumableAssessmentTestSession(assessedIdentity, anonymousIdentifier, entry, subIdent, testEntry, authorMode);
    if (lastSession == null) {
        initNewAssessmentTestSession(ureq, assessmentEntry, authorMode);
    } else {
        candidateSession = lastSession;
        extraTime = lastSession.getExtraTime();
        candidateAuditLogger = qtiService.getAssessmentSessionAuditLogger(candidateSession, authorMode);
        lastEvent = new CandidateEvent(candidateSession, testEntry, entry);
        lastEvent.setTestEventType(CandidateTestEventType.ITEM_EVENT);
        if (authorMode) {
            // check that the resumed session match the current test
            try {
                testSessionController = resumeSession(ureq);
                if (!checkAuthorSession()) {
                    initNewAssessmentTestSession(ureq, assessmentEntry, authorMode);
                }
            } catch (Exception e) {
                logError("Cannot resume session as author", e);
                initNewAssessmentTestSession(ureq, assessmentEntry, authorMode);
            }
        } else {
            testSessionController = resumeSession(ureq);
        }
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) ResponseBindingException(uk.ac.ed.ph.jqtiplus.exception.ResponseBindingException) QtiXmlInterpretationException(uk.ac.ed.ph.jqtiplus.reading.QtiXmlInterpretationException) QtiCandidateStateException(uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException) BadResourceException(uk.ac.ed.ph.jqtiplus.provision.BadResourceException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 59 with CandidateEvent

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

the class AssessmentTestDisplayController method processItemSolution.

private void processItemSolution(UserRequest ureq, String key) {
    TestPlanNodeKey itemKey = TestPlanNodeKey.fromString(key);
    NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    // assertSessionNotTerminated(candidateSession);
    try {
        if (!testSessionController.mayAccessItemSolution(itemKey)) {
            candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, null);
            logError("CANNOT_SOLUTION_TEST_ITEM", null);
            return;
        }
    } catch (final QtiCandidateStateException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, e);
        logError("CANNOT_SOLUTION_TEST_ITEM", e);
        return;
    } catch (final RuntimeException e) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_SOLUTION_TEST_ITEM, e);
        logError("Exploded", e);
        // handleExplosion(e, candidateSession);
        return;
    }
    /* Record current result state */
    computeAndRecordTestAssessmentResult(ureq.getRequestTimestamp(), testSessionState, false);
    /* Record and log event */
    CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.SOLUTION_ITEM, null, itemKey, testSessionState, notificationRecorder);
    this.lastEvent = candidateTestEvent;
    candidateAuditLogger.logCandidateEvent(candidateTestEvent);
}
Also used : QtiCandidateStateException(uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Example 60 with CandidateEvent

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

the class AssessmentTreeComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    AssessmentTreeComponent component = (AssessmentTreeComponent) source;
    TestSessionController testSessionController = component.getTestSessionController();
    if (!testSessionController.getTestSessionState().isEnded()) {
        CandidateSessionContext candidateSessionContext = component.getCandidateSessionContext();
        final AssessmentTestSession candidateSession = candidateSessionContext.getCandidateSession();
        if (!candidateSession.isExploded() && !candidateSessionContext.isTerminated()) {
            CandidateEvent candidateEvent = candidateSessionContext.getLastEvent();
            CandidateTestEventType testEventType = candidateEvent.getTestEventType();
            RenderingRequest options;
            if (testEventType == CandidateTestEventType.REVIEW_ITEM) {
                options = RenderingRequest.getItemReview();
            } else if (testEventType == CandidateTestEventType.SOLUTION_ITEM) {
                options = RenderingRequest.getItemSolution();
            } else {
                options = RenderingRequest.getItem(testSessionController);
            }
            AssessmentRenderer renderHints = new AssessmentRenderer(renderer);
            renderTestEvent(testSessionController, renderHints, sb, component, ubu, translator, options);
        }
    }
}
Also used : CandidateSessionContext(org.olat.ims.qti21.ui.CandidateSessionContext) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) CandidateTestEventType(org.olat.ims.qti21.model.audit.CandidateTestEventType) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Aggregations

CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)54 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)36 Date (java.util.Date)34 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)32 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)22 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)21 AssessmentResult (uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult)20 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)20 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)16 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)14 CandidateTestEventType (org.olat.ims.qti21.model.audit.CandidateTestEventType)12 AssessmentResponse (org.olat.ims.qti21.AssessmentResponse)10 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)10 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)10 HashMap (java.util.HashMap)8 CandidateItemEventType (org.olat.ims.qti21.model.audit.CandidateItemEventType)8 CandidateSessionContext (org.olat.ims.qti21.ui.CandidateSessionContext)8 StringInput (org.olat.ims.qti21.ui.ResponseInput.StringInput)8 FileResponseData (uk.ac.ed.ph.jqtiplus.types.FileResponseData)8 ResponseData (uk.ac.ed.ph.jqtiplus.types.ResponseData)8