Search in sources :

Example 66 with TestSessionState

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

the class AssessmentTreeComponentRenderer method renderNavigationAssessmentItem.

private void renderNavigationAssessmentItem(StringOutput sb, AssessmentTreeComponent component, TestPlanNode itemNode, Translator translator, RenderingRequest options) {
    // check if currently rendered item is the active item
    boolean active = false;
    TestSessionController sessionCtr = component.getTestSessionController();
    if (sessionCtr != null && itemNode != null) {
        TestSessionState sessionState = sessionCtr.getTestSessionState();
        if (sessionState != null && sessionState.getCurrentItemKey() != null) {
            TestPlanNodeKey testPlanNodeKey = sessionState.getCurrentItemKey();
            active = (testPlanNodeKey.getIdentifier().equals(itemNode.getIdentifier()));
        }
    }
    sb.append("<li class='o_assessmentitem").append(" active", active).append("'>");
    try {
        renderAssessmentItemMark(sb, component, itemNode, translator);
        renderAssessmentItemAttempts(sb, component, itemNode, translator);
        renderItemStatus(sb, component, itemNode, translator, options);
        renderAssessmentItemLink(sb, component, itemNode, translator);
    } catch (IllegalStateException ex) {
        log.error("", ex);
        sb.append("<span class='o_danger'>ERROR</span>");
    }
    sb.append("</li>");
}
Also used : TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 67 with TestSessionState

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

the class QTI21IdentityListCourseNodeToolsController method doOpenCorrection.

private void doOpenCorrection(UserRequest ureq) {
    File unzippedDirRoot = FileResourceManager.getInstance().unzipFileResource(testEntry.getOlatResource());
    ResolvedAssessmentTest resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
    ManifestBuilder manifestBuilder = ManifestBuilder.read(new File(unzippedDirRoot, "imsmanifest.xml"));
    TestSessionState testSessionState = qtiService.loadTestSessionState(lastSession);
    Map<Identity, AssessmentTestSession> lastSessionMap = new HashMap<>();
    lastSessionMap.put(assessedIdentity, lastSession);
    Map<Identity, TestSessionState> testSessionStates = new HashMap<>();
    testSessionStates.put(assessedIdentity, testSessionState);
    CorrectionOverviewModel model = new CorrectionOverviewModel(courseEntry, testCourseNode.getIdent(), testEntry, resolvedAssessmentTest, manifestBuilder, lastSessionMap, testSessionStates);
    correctionCtrl = new CorrectionIdentityAssessmentItemListController(ureq, getWindowControl(), stackPanel, model, lastSession, assessedIdentity);
    listenTo(correctionCtrl);
    stackPanel.pushController(translate("tool.correction"), correctionCtrl);
}
Also used : CorrectionOverviewModel(org.olat.ims.qti21.ui.assessment.CorrectionOverviewModel) ManifestBuilder(org.olat.ims.qti21.model.xml.ManifestBuilder) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) CorrectionIdentityAssessmentItemListController(org.olat.ims.qti21.ui.assessment.CorrectionIdentityAssessmentItemListController) HashMap(java.util.HashMap) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) Identity(org.olat.core.id.Identity) File(java.io.File)

Example 68 with TestSessionState

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

the class AssessmentTestDisplayController method createNewTestSessionStateAndController.

private TestSessionController createNewTestSessionStateAndController(NotificationRecorder notificationRecorder) {
    TestProcessingMap testProcessingMap = getTestProcessingMap();
    /* Generate a test plan for this session */
    final TestPlanner testPlanner = new TestPlanner(testProcessingMap);
    if (notificationRecorder != null) {
        testPlanner.addNotificationListener(notificationRecorder);
    }
    final TestPlan testPlan = testPlanner.generateTestPlan();
    final TestSessionState testSessionState = new TestSessionState(testPlan);
    final TestSessionControllerSettings testSessionControllerSettings = new TestSessionControllerSettings();
    testSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
    testProcessingMap.reduceItemProcessingMapMap(testPlan.getTestPlanNodeList());
    /* Create controller and wire up notification recorder */
    final TestSessionController result = new TestSessionController(qtiService.jqtiExtensionManager(), testSessionControllerSettings, testProcessingMap, testSessionState);
    if (notificationRecorder != null) {
        result.addNotificationListener(notificationRecorder);
    }
    return result;
}
Also used : TestSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.TestSessionControllerSettings) TestProcessingMap(uk.ac.ed.ph.jqtiplus.state.TestProcessingMap) TestPlanner(uk.ac.ed.ph.jqtiplus.running.TestPlanner) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestPlan(uk.ac.ed.ph.jqtiplus.state.TestPlan) TestSessionController(uk.ac.ed.ph.jqtiplus.running.TestSessionController)

Example 69 with TestSessionState

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

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 70 with TestSessionState

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

the class AssessmentTestDisplayController method processExitTestAfterTimeLimit.

private void processExitTestAfterTimeLimit(UserRequest ureq) {
    synchronized (testSessionController) {
        // make sure the ajax call and a user click don't close both the session
        NotificationRecorder notificationRecorder = new NotificationRecorder(NotificationLevel.INFO);
        TestSessionState testSessionState = testSessionController.getTestSessionState();
        if (testSessionState.isEnded() || testSessionState.isExited())
            return;
        // close duration
        testSessionController.touchDurations(currentRequestTimestamp);
        final Date requestTimestamp = ureq.getRequestTimestamp();
        testSessionController.exitTestIncomplete(requestTimestamp);
        candidateSession.setTerminationTime(requestTimestamp);
        // Record current result state
        final AssessmentResult assessmentResult = computeAndRecordTestAssessmentResult(requestTimestamp, testSessionState, true);
        candidateSession = qtiService.finishTestSession(candidateSession, testSessionState, assessmentResult, requestTimestamp, getDigitalSignatureOptions(), getIdentity());
        qtiWorksCtrl.updateStatusAndResults(ureq);
        /* Record and log event */
        final CandidateEvent candidateTestEvent = qtiService.recordCandidateTestEvent(candidateSession, testEntry, entry, CandidateTestEventType.EXIT_DUE_TIME_LIMIT, testSessionState, notificationRecorder);
        candidateAuditLogger.logCandidateEvent(candidateTestEvent);
        this.lastEvent = candidateTestEvent;
    }
    doExitTest(ureq);
}
Also used : TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) 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

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