Search in sources :

Example 6 with AssessmentSectionSessionState

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

the class QTI21ServiceImpl method resumeItem.

private void resumeItem(TestPlanNodeKey lastEntryItemKey, TestSessionState testSessionState) {
    TestPlan plan = testSessionState.getTestPlan();
    Date now = new Date();
    for (TestPlanNode currentNode = plan.getNode(lastEntryItemKey); currentNode != null; currentNode = currentNode.getParent()) {
        TestNodeType type = currentNode.getTestNodeType();
        TestPlanNodeKey currentNodeKey = currentNode.getKey();
        switch(type) {
            case TEST_PART:
                {
                    TestPartSessionState state = testSessionState.getTestPartSessionStates().get(currentNodeKey);
                    if (state != null) {
                        state.setDurationIntervalStartTime(now);
                    }
                    break;
                }
            case ASSESSMENT_SECTION:
                {
                    AssessmentSectionSessionState sessionState = testSessionState.getAssessmentSectionSessionStates().get(currentNodeKey);
                    if (sessionState != null) {
                        sessionState.setDurationIntervalStartTime(now);
                    }
                    break;
                }
            case ASSESSMENT_ITEM_REF:
                {
                    ItemSessionState itemState = testSessionState.getItemSessionStates().get(currentNodeKey);
                    if (itemState != null) {
                        itemState.setDurationIntervalStartTime(now);
                    }
                    break;
                }
            default:
                {
                    // root doesn't match any session state
                    break;
                }
        }
    }
}
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) Date(java.util.Date) TestNodeType(uk.ac.ed.ph.jqtiplus.state.TestPlanNode.TestNodeType) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 7 with AssessmentSectionSessionState

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

the class AssessmentTestComponentRenderer method renderReviewAssessmentSection.

private void renderReviewAssessmentSection(AssessmentRenderer renderer, StringOutput sb, AssessmentTestComponent component, TestPlanNode sectionNode, URLBuilder ubu, Translator translator) {
    AssessmentSectionSessionState assessmentSessionSessionState = component.getTestSessionController().getTestSessionState().getAssessmentSectionSessionStates().get(sectionNode.getKey());
    TestPart currentTestPart = component.getTestPart(component.getCurrentTestPartNode().getIdentifier());
    // <xsl:if test="$currentTestPart/@navigationMode='nonlinear' or exists($assessmentSessionSessionState/@entryTime)">
    if (currentTestPart.getNavigationMode() == NavigationMode.NONLINEAR || assessmentSessionSessionState.getEntryTime() != null) {
        sb.append("<li class='o_assessmentsection'>").append("<header><h2>").append(StringHelper.escapeHtml(sectionNode.getSectionPartTitle())).append("</h2>");
        renderAssessmentSectionRubrickBlock(renderer, sb, component, sectionNode, ubu, translator);
        sb.append("</header>");
        sb.append("<ul class='o_testpartnavigation_inner list-unstyled'>");
        sectionNode.getChildren().forEach((childNode) -> renderReview(renderer, sb, component, childNode, ubu, translator));
        sb.append("</ul>");
    }
}
Also used : TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) AssessmentSectionSessionState(uk.ac.ed.ph.jqtiplus.state.AssessmentSectionSessionState)

Example 8 with AssessmentSectionSessionState

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

Aggregations

AssessmentSectionSessionState (uk.ac.ed.ph.jqtiplus.state.AssessmentSectionSessionState)8 TestPlan (uk.ac.ed.ph.jqtiplus.state.TestPlan)6 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)6 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)6 HashMap (java.util.HashMap)4 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)4 TestPartSessionState (uk.ac.ed.ph.jqtiplus.state.TestPartSessionState)4 TestNodeType (uk.ac.ed.ph.jqtiplus.state.TestPlanNode.TestNodeType)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)2 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)2 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)2