Search in sources :

Example 1 with TestNodeType

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

the class AssessmentResultController method initFormSections.

private void initFormSections(FormLayoutContainer layoutCont, Results testResults) {
    List<Results> itemResults = new ArrayList<>();
    layoutCont.contextPut("itemResults", itemResults);
    Map<Identifier, AssessmentItemRef> identifierToRefs = new HashMap<>();
    for (AssessmentItemRef itemRef : resolvedAssessmentTest.getAssessmentItemRefs()) {
        identifierToRefs.put(itemRef.getIdentifier(), itemRef);
    }
    Map<TestPlanNode, Results> resultsMap = new HashMap<>();
    TestPlan testPlan = testSessionState.getTestPlan();
    List<TestPlanNode> nodes = testPlan.getTestPlanNodeList();
    for (TestPlanNode node : nodes) {
        TestPlanNodeKey testPlanNodeKey = node.getKey();
        TestNodeType testNodeType = node.getTestNodeType();
        if (testNodeType == TestNodeType.ASSESSMENT_SECTION) {
            Results r = new Results(true, node.getSectionPartTitle(), "o_mi_qtisection", options.isSectionSummary());
            AssessmentSectionSessionState sectionState = testSessionState.getAssessmentSectionSessionStates().get(testPlanNodeKey);
            if (sectionState != null) {
                r.setSessionState(sectionState);
            }
            resultsMap.put(node, r);
            itemResults.add(r);
            testResults.setNumberOfSections(testResults.getNumberOfSections() + 1);
        } else if (testNodeType == TestNodeType.ASSESSMENT_ITEM_REF) {
            Results results = initFormItemResult(layoutCont, node, identifierToRefs, resultsMap);
            if (results != null) {
                itemResults.add(results);
            }
            testResults.setNumberOfQuestions(testResults.getNumberOfQuestions() + 1);
            if (results.sessionStatus == SessionStatus.FINAL) {
                testResults.setNumberOfAnsweredQuestions(testResults.getNumberOfAnsweredQuestions() + 1);
            }
            if (results.hasMaxScore()) {
                testResults.addMaxScore(results);
            }
        }
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) HashMap(java.util.HashMap) TestPlan(uk.ac.ed.ph.jqtiplus.state.TestPlan) ArrayList(java.util.ArrayList) AssessmentSectionSessionState(uk.ac.ed.ph.jqtiplus.state.AssessmentSectionSessionState) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) TestNodeType(uk.ac.ed.ph.jqtiplus.state.TestPlanNode.TestNodeType) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 2 with TestNodeType

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

the class AssessmentResultController method initFormSections.

private void initFormSections(FormLayoutContainer layoutCont, Results testResults) {
    List<Results> itemResults = new ArrayList<>();
    layoutCont.contextPut("itemResults", itemResults);
    Map<Identifier, AssessmentItemRef> identifierToRefs = new HashMap<>();
    for (AssessmentItemRef itemRef : resolvedAssessmentTest.getAssessmentItemRefs()) {
        identifierToRefs.put(itemRef.getIdentifier(), itemRef);
    }
    Map<TestPlanNode, Results> resultsMap = new HashMap<>();
    TestPlan testPlan = testSessionState.getTestPlan();
    List<TestPlanNode> nodes = testPlan.getTestPlanNodeList();
    for (TestPlanNode node : nodes) {
        TestPlanNodeKey testPlanNodeKey = node.getKey();
        TestNodeType testNodeType = node.getTestNodeType();
        if (testNodeType == TestNodeType.ASSESSMENT_SECTION) {
            Results r = new Results(true, node.getSectionPartTitle(), "o_mi_qtisection", options.isSectionSummary());
            AssessmentSectionSessionState sectionState = testSessionState.getAssessmentSectionSessionStates().get(testPlanNodeKey);
            if (sectionState != null) {
                r.setSessionState(sectionState);
            }
            resultsMap.put(node, r);
            itemResults.add(r);
            testResults.setNumberOfSections(testResults.getNumberOfSections() + 1);
        } else if (testNodeType == TestNodeType.ASSESSMENT_ITEM_REF) {
            Results results = initFormItemResult(layoutCont, node, identifierToRefs, resultsMap);
            if (results != null) {
                itemResults.add(results);
            }
            testResults.setNumberOfQuestions(testResults.getNumberOfQuestions() + 1);
            if (results.sessionStatus == SessionStatus.FINAL) {
                testResults.setNumberOfAnsweredQuestions(testResults.getNumberOfAnsweredQuestions() + 1);
            }
            if (results.hasMaxScore()) {
                testResults.addMaxScore(results);
            }
        }
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) HashMap(java.util.HashMap) TestPlan(uk.ac.ed.ph.jqtiplus.state.TestPlan) ArrayList(java.util.ArrayList) AssessmentSectionSessionState(uk.ac.ed.ph.jqtiplus.state.AssessmentSectionSessionState) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) TestNodeType(uk.ac.ed.ph.jqtiplus.state.TestPlanNode.TestNodeType) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 3 with TestNodeType

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

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 4 with TestNodeType

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

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

the class QTI21AssessmentDetailsController method updateModel.

protected void updateModel() {
    List<AssessmentTestSessionStatistics> sessionsStatistics = qtiService.getAssessmentTestSessionsStatistics(entry, subIdent, assessedIdentity);
    List<QTI21AssessmentTestSessionDetails> infos = new ArrayList<>();
    for (AssessmentTestSessionStatistics sessionStatistics : sessionsStatistics) {
        AssessmentTestSession testSession = sessionStatistics.getTestSession();
        TestSessionState testSessionState = qtiService.loadTestSessionState(testSession);
        TestPlan testPlan = testSessionState.getTestPlan();
        List<TestPlanNode> nodes = testPlan.getTestPlanNodeList();
        int responded = 0;
        int numOfItems = 0;
        for (TestPlanNode node : nodes) {
            TestNodeType testNodeType = node.getTestNodeType();
            ItemSessionState itemSessionState = testSessionState.getItemSessionStates().get(node.getKey());
            TestPlanNodeKey testPlanNodeKey = node.getKey();
            if (testPlanNodeKey != null && testPlanNodeKey.getIdentifier() != null && testNodeType == TestNodeType.ASSESSMENT_ITEM_REF) {
                numOfItems++;
                if (itemSessionState.isResponded()) {
                    responded++;
                }
            }
        }
        infos.add(new QTI21AssessmentTestSessionDetails(testSession, numOfItems, responded, sessionStatistics.getNumOfCorrectedItems()));
    }
    Collections.sort(infos, new AssessmentTestSessionDetailsComparator());
    tableModel.setObjects(infos);
    tableEl.reloadData();
    tableEl.reset();
    if (resetButton != null) {
        resetButton.setVisible(!sessionsStatistics.isEmpty());
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) AssessmentTestSessionStatistics(org.olat.ims.qti21.model.jpa.AssessmentTestSessionStatistics) TestPlan(uk.ac.ed.ph.jqtiplus.state.TestPlan) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ArrayList(java.util.ArrayList) TestNodeType(uk.ac.ed.ph.jqtiplus.state.TestPlanNode.TestNodeType) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Aggregations

TestPlan (uk.ac.ed.ph.jqtiplus.state.TestPlan)6 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)6 TestNodeType (uk.ac.ed.ph.jqtiplus.state.TestPlanNode.TestNodeType)6 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)6 ArrayList (java.util.ArrayList)4 AssessmentSectionSessionState (uk.ac.ed.ph.jqtiplus.state.AssessmentSectionSessionState)4 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)4 Date (java.util.Date)2 HashMap (java.util.HashMap)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 AssessmentTestSessionStatistics (org.olat.ims.qti21.model.jpa.AssessmentTestSessionStatistics)2 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)2 TestPartSessionState (uk.ac.ed.ph.jqtiplus.state.TestPartSessionState)2 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)2 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)2