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