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);
}
}
}
}
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);
}
}
}
}
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;
}
}
}
}
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;
}
}
}
}
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());
}
}
Aggregations