Search in sources :

Example 6 with TestNodeType

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

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