Search in sources :

Example 36 with TestPlanNode

use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.

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 37 with TestPlanNode

use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.

the class AssessmentTestDisplayController method nextItemIfAllowed.

/**
 * Try to go to the next item. It will check fi the current
 * item want to show some feedback (modal or element), has some
 * bad or invalid responses, state of the test session... or if
 * the item is an adaptive one.
 *
 * @param ureq
 */
private void nextItemIfAllowed(UserRequest ureq) {
    if (testSessionController.hasFollowingNonLinearItem() && testSessionController.getTestSessionState() != null && !testSessionController.getTestSessionState().isEnded() && !testSessionController.getTestSessionState().isExited()) {
        try {
            TestSessionState testSessionState = testSessionController.getTestSessionState();
            TestPlanNodeKey itemNodeKey = testSessionState.getCurrentItemKey();
            if (itemNodeKey != null) {
                TestPlanNode currentItemNode = testSessionState.getTestPlan().getNode(itemNodeKey);
                boolean hasFeedbacks = qtiWorksCtrl.willShowSomeAssessmentItemFeedbacks(currentItemNode);
                // allow skipping
                if (!hasFeedbacks) {
                    processNextItem(ureq);
                }
            }
        } catch (QtiCandidateStateException e) {
            // log informations
            logError("", e);
            ServletUtil.printOutRequestParameters(ureq.getHttpReq());
        }
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) QtiCandidateStateException(uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 38 with TestPlanNode

use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode 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)

Example 39 with TestPlanNode

use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.

the class AssessmentTestDisplayController method confirmEndTestPart.

private void confirmEndTestPart(UserRequest ureq) {
    TestPlanNode nextTestPart = testSessionController.findNextEnterableTestPart();
    if (nextTestPart == null) {
        String title = translate("confirm.finish.test.title");
        String text = translate("confirm.finish.test.text");
        endTestPartDialog = activateOkCancelDialog(ureq, title, text, endTestPartDialog);
    } else {
        TestPart currentTestPart = testSessionController.getCurrentTestPart();
        if (currentTestPart == null) {
            processEndTestPart(ureq);
        } else {
            String title = translate("confirm.finish.testpart.title");
            String text = translate("confirm.finish.testpart.text");
            endTestPartDialog = activateOkCancelDialog(ureq, title, text, endTestPartDialog);
        }
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 40 with TestPlanNode

use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project OpenOLAT by OpenOLAT.

the class AssessmentTestDisplayController method suspendAssessmentTest.

/**
 * It suspend the current item
 * @return
 */
private boolean suspendAssessmentTest(Date requestTimestamp) {
    if (!deliveryOptions.isEnableSuspend() || testSessionController == null || testSessionController.getTestSessionState() == null || testSessionController.getTestSessionState().isEnded() || testSessionController.getTestSessionState().isExited() || testSessionController.getTestSessionState().isSuspended()) {
        return false;
    }
    testSessionController.touchDurations(currentRequestTimestamp);
    testSessionController.suspendTestSession(requestTimestamp);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    TestPlanNodeKey currentItemKey = testSessionState.getCurrentItemKey();
    if (currentItemKey == null) {
        return false;
    }
    TestPlanNode currentItemNode = testSessionState.getTestPlan().getNode(currentItemKey);
    ItemProcessingContext itemProcessingContext = testSessionController.getItemProcessingContext(currentItemNode);
    ItemSessionState itemSessionState = itemProcessingContext.getItemSessionState();
    if (itemProcessingContext instanceof ItemSessionController && !itemSessionState.isEnded() && !itemSessionState.isExited() && itemSessionState.isOpen() && !itemSessionState.isSuspended()) {
        ItemSessionController itemSessionController = (ItemSessionController) itemProcessingContext;
        itemSessionController.suspendItemSession(requestTimestamp);
        computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, false);
        NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
        final CandidateEvent candidateEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.SUSPEND, null, null, testSessionState, notificationRecorder);
        candidateAuditLogger.logCandidateEvent(candidateEvent);
        this.lastEvent = candidateEvent;
        return true;
    }
    return false;
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey) ItemProcessingContext(uk.ac.ed.ph.jqtiplus.running.ItemProcessingContext) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Aggregations

TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)54 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)32 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)26 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)22 Date (java.util.Date)16 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)16 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)14 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)10 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)10 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)10 TestPlan (uk.ac.ed.ph.jqtiplus.state.TestPlan)10 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)8 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)8 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)8 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)8 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)7 OLATResourceable (org.olat.core.id.OLATResourceable)6 ParentPartItemRefs (org.olat.ims.qti21.model.ParentPartItemRefs)6 CandidateTestEventType (org.olat.ims.qti21.model.audit.CandidateTestEventType)6