Search in sources :

Example 46 with TestPlanNodeKey

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

the class AssessmentTestComponent method getResponseUniqueIdentifier.

@Override
public String getResponseUniqueIdentifier(ItemSessionState itemSessionState, Interaction interaction) {
    TestPlanNodeKey tpnk = null;
    for (Map.Entry<TestPlanNodeKey, ItemSessionState> entry : testSessionController.getTestSessionState().getItemSessionStates().entrySet()) {
        if (entry.getValue() == itemSessionState) {
            tpnk = entry.getKey();
            break;
        }
    }
    String id = "oo" + (tpnk.toString().replace(":", "_")) + "_" + interaction.getResponseIdentifier().toString();
    responseIdentifiersMap.put(id, interaction);
    return id;
}
Also used : ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) HashMap(java.util.HashMap) Map(java.util.Map) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 47 with TestPlanNodeKey

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

the class AssessmentTreeComponent method getCurrentTestPartNode.

public TestPlanNode getCurrentTestPartNode() {
    TestSessionState sessionState = getTestSessionController().getTestSessionState();
    TestPlanNodeKey testPlanNodeKey = sessionState.getCurrentTestPartKey();
    return testPlanNodeKey == null ? null : sessionState.getTestPlan().getNode(testPlanNodeKey);
}
Also used : TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 48 with TestPlanNodeKey

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

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

the class QTI21ServiceImpl method reopenTestPart.

private TestPlanNodeKey reopenTestPart(TestPlanNode lastItem, TestSessionState testSessionState) {
    TestPlan plan = testSessionState.getTestPlan();
    List<TestPlanNode> testPartNodes = lastItem.searchAncestors(TestNodeType.TEST_PART);
    if (testPartNodes.isEmpty()) {
        return null;
    }
    // reopen the test part of the selected item
    TestPlanNode partNode = testPartNodes.get(0);
    TestPlanNodeKey partKey = partNode.getKey();
    TestPartSessionState partState = testSessionState.getTestPartSessionStates().get(partKey);
    partState.setEndTime(null);
    partState.setExitTime(null);
    // reopen all sections the test part
    for (Map.Entry<TestPlanNodeKey, AssessmentSectionSessionState> sectionEntry : testSessionState.getAssessmentSectionSessionStates().entrySet()) {
        TestPlanNodeKey sectionKey = sectionEntry.getKey();
        TestPlanNode sectionNode = plan.getNode(sectionKey);
        if (sectionNode.hasAncestor(partNode)) {
            AssessmentSectionSessionState sectionState = sectionEntry.getValue();
            sectionState.setEndTime(null);
            sectionState.setExitTime(null);
        }
    }
    // reopen all items the test part
    for (Map.Entry<TestPlanNodeKey, ItemSessionState> itemEntry : testSessionState.getItemSessionStates().entrySet()) {
        TestPlanNodeKey itemKey = itemEntry.getKey();
        TestPlanNode itemNode = plan.getNode(itemKey);
        if (itemNode.hasAncestor(partNode)) {
            ItemSessionState itemState = itemEntry.getValue();
            itemState.setEndTime(null);
            itemState.setExitTime(null);
        }
    }
    return partKey;
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) TestPlan(uk.ac.ed.ph.jqtiplus.state.TestPlan) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) TestPartSessionState(uk.ac.ed.ph.jqtiplus.state.TestPartSessionState) AssessmentSectionSessionState(uk.ac.ed.ph.jqtiplus.state.AssessmentSectionSessionState) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 50 with TestPlanNodeKey

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

Aggregations

TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)52 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)42 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)26 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)26 HashMap (java.util.HashMap)18 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)18 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)16 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)16 ArrayList (java.util.ArrayList)12 Date (java.util.Date)12 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)12 Map (java.util.Map)10 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)10 TestPlan (uk.ac.ed.ph.jqtiplus.state.TestPlan)10 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)10 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)8 TestPartSessionState (uk.ac.ed.ph.jqtiplus.state.TestPartSessionState)8 ParentPartItemRefs (org.olat.ims.qti21.model.ParentPartItemRefs)6 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)6 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)6