Search in sources :

Example 46 with TestSessionState

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

the class AssessmentTestDisplayController method processNextItem.

private void processNextItem(UserRequest ureq) {
    if (checkConcurrentExit(ureq)) {
        return;
    }
    Date requestTimestamp = ureq.getRequestTimestamp();
    if (testSessionController.hasFollowingNonLinearItem()) {
        TestPlanNode selectedNode = testSessionController.selectFollowingItemNonLinear(requestTimestamp);
        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.NEXT_ITEM, 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 47 with TestSessionState

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

the class AssessmentTestDisplayController method resumeSession.

private TestSessionController resumeSession(UserRequest ureq) {
    Date requestTimestamp = ureq.getRequestTimestamp();
    final NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    TestSessionController controller = createTestSessionController(notificationRecorder);
    if (!controller.getTestSessionState().isEnded() && !controller.getTestSessionState().isExited()) {
        controller.unsuspendTestSession(requestTimestamp);
        TestSessionState testSessionState = controller.getTestSessionState();
        TestPlanNodeKey currentItemKey = testSessionState.getCurrentItemKey();
        if (currentItemKey != null) {
            TestPlanNode currentItemNode = testSessionState.getTestPlan().getNode(currentItemKey);
            ItemProcessingContext itemProcessingContext = controller.getItemProcessingContext(currentItemNode);
            ItemSessionState itemSessionState = itemProcessingContext.getItemSessionState();
            if (itemProcessingContext instanceof ItemSessionController && itemSessionState.isSuspended()) {
                ItemSessionController itemSessionController = (ItemSessionController) itemProcessingContext;
                itemSessionController.unsuspendItemSession(requestTimestamp);
            }
        }
    }
    return controller;
}
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) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController) Date(java.util.Date) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey) ItemProcessingContext(uk.ac.ed.ph.jqtiplus.running.ItemProcessingContext)

Example 48 with TestSessionState

use of uk.ac.ed.ph.jqtiplus.state.TestSessionState 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 49 with TestSessionState

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

the class AssessmentTestDisplayController method doCancel.

private void doCancel(UserRequest ureq) {
    VelocityContainer cancelledVC = createVelocityContainer("cancelled");
    mainPanel.setContent(cancelledVC);
    // only cancel unfinished test (prevent concurrent pull session / cancel to delete the data)
    if (candidateSession.getFinishTime() == null) {
        TestSessionState testSessionState = testSessionController.getTestSessionState();
        qtiService.cancelTestSession(candidateSession, testSessionState);
    }
    fireEvent(ureq, Event.CANCELLED_EVENT);
    candidateSession = null;
}
Also used : TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 50 with TestSessionState

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

the class AssessmentTestDisplayController method processReviewTestPart.

private void processReviewTestPart() {
    NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
    TestSessionState testSessionState = testSessionController.getTestSessionState();
    // assertSessionNotTerminated(candidateSession);
    if (testSessionState.getCurrentTestPartKey() == null || !testSessionState.getCurrentTestPartSessionState().isEnded()) {
        candidateAuditLogger.logAndThrowCandidateException(candidateSession, CandidateExceptionReason.CANNOT_REVIEW_TEST_PART, null);
        logError("CANNOT_REVIEW_TEST_PART", null);
        return;
    }
    /* Record and log event */
    final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.REVIEW_TEST_PART, null, null, testSessionState, notificationRecorder);
    candidateAuditLogger.logCandidateEvent(candidateTestEvent);
    this.lastEvent = candidateTestEvent;
}
Also used : TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent)

Aggregations

TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)78 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)42 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)34 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)32 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)30 Date (java.util.Date)24 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)24 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)19 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)18 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)18 HashMap (java.util.HashMap)15 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)13 AssessmentResult (uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult)12 TestSessionController (uk.ac.ed.ph.jqtiplus.running.TestSessionController)12 ArrayList (java.util.ArrayList)10 CandidateTestEventType (org.olat.ims.qti21.model.audit.CandidateTestEventType)10 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)10 Identity (org.olat.core.id.Identity)9 File (java.io.File)8 ParentPartItemRefs (org.olat.ims.qti21.model.ParentPartItemRefs)8