use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project openolat by klemens.
the class AssessmentTestComponentRenderer method renderTestPartFeedback.
private void renderTestPartFeedback(AssessmentRenderer renderer, StringOutput sb, AssessmentTestComponent component, URLBuilder ubu, Translator translator) {
sb.append("<div class='qtiworks o_assessmenttest testFeedback'>").append("<h1>");
if (component.hasMultipleTestParts()) {
sb.append(translator.translate("test.part.complete"));
} else {
sb.append(translator.translate("test.complete"));
}
sb.append("</h1>");
// Show 'atEnd' testPart feedback
TestPlanNode currentTestPartNode = component.getCurrentTestPartNode();
TestPart currentTestPart = component.getTestPart(currentTestPartNode.getIdentifier());
renderTestFeebacks(renderer, sb, currentTestPart.getTestFeedbacks(), component, TestFeedbackAccess.AT_END, ubu, translator);
// Show 'atEnd' test feedback f there's only 1 testPart
// if(!component.hasMultipleTestParts()) {
renderTestFeebacks(renderer, sb, component.getAssessmentTest().getTestFeedbacks(), component, TestFeedbackAccess.AT_END, ubu, translator);
// }
// test part review
component.getTestSessionController().getTestSessionState().getTestPlan().getTestPartNodes().forEach((testPartNode) -> renderReview(renderer, sb, component, testPartNode, ubu, translator));
// controls
/*
sb.append("<div class='o_button_group'>");
String title = component.hasMultipleTestParts()
? translator.translate("assessment.test.end.testPart") : translator.translate("assessment.test.end.test");
renderControl(sb, component, title, "o_sel_end_testpart",
new NameValuePair("cid", Event.advanceTestPart.name()));
sb.append("</div>");
*/
sb.append("</div>");
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project openolat by klemens.
the class CorrectionIdentityAssessmentItemListController method doSelect.
private void doSelect(UserRequest ureq, CorrectionIdentityAssessmentItemRow row) {
removeAsListenerAndDispose(identityItemCtrl);
doUnlock();
AssessmentItemRef itemRef = row.getItemRef();
TestSessionState testSessionState = qtiService.loadTestSessionState(candidateSession);
List<TestPlanNode> nodes = testSessionState.getTestPlan().getNodes(itemRef.getIdentifier());
AssessmentItemSession reloadItemSession = null;
if (nodes.size() == 1) {
TestPlanNode itemNode = nodes.get(0);
String stringuifiedIdentifier = itemNode.getKey().getIdentifier().toString();
ParentPartItemRefs parentParts = AssessmentTestHelper.getParentSection(itemNode.getKey(), testSessionState, model.getResolvedAssessmentTest());
reloadItemSession = qtiService.getOrCreateAssessmentItemSession(candidateSession, parentParts, stringuifiedIdentifier);
}
// lock on item, need to check the lock on identity / test
String lockSubKey = "item-" + reloadItemSession.getKey();
OLATResourceable testOres = OresHelper.clone(model.getTestEntry().getOlatResource());
lockResult = CoordinatorManager.getInstance().getCoordinator().getLocker().acquireLock(testOres, getIdentity(), lockSubKey);
if (lockResult.isSuccess()) {
if (nodes.size() == 1) {
TestPlanNode itemNode = nodes.get(0);
ItemSessionState itemSessionState = testSessionState.getItemSessionStates().get(itemNode.getKey());
AssessmentItemCorrection itemCorrection = new AssessmentItemCorrection(assessedIdentity, candidateSession, testSessionState, reloadItemSession, itemSessionState, itemRef, itemNode);
itemCorrection.setItemSession(reloadItemSession);
ResolvedAssessmentItem resolvedAssessmentItem = model.getResolvedAssessmentTest().getResolvedAssessmentItem(itemRef);
AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
identityItemCtrl = new CorrectionIdentityAssessmentItemNavigationController(ureq, getWindowControl(), model.getTestEntry(), model.getResolvedAssessmentTest(), itemCorrection, row, tableModel.getObjects(), model);
listenTo(identityItemCtrl);
stackPanel.pushController(assessmentItem.getTitle(), identityItemCtrl);
updatePreviousNext();
}
} else {
String lockOwnerName = userManager.getUserDisplayName(lockResult.getOwner());
showWarning("warning.assessment.item.locked", new String[] { lockOwnerName });
}
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode 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());
}
}
use of uk.ac.ed.ph.jqtiplus.state.TestPlanNode in project openolat by klemens.
the class AssessmentTreeComponentRenderer method renderNavigation.
private void renderNavigation(AssessmentRenderer renderer, StringOutput sb, AssessmentTreeComponent component, URLBuilder ubu, Translator translator, RenderingRequest options) {
sb.append("<div id='o_qti_menu' class='qtiworks o_assessmenttest o_testpartnavigation o_qti_menu_menustyle'>");
// part, sections and item refs
TestPlanNode currentTestPartNode = component.getCurrentTestPartNode();
if (currentTestPartNode != null) {
sb.append("<ul class='o_testpartnavigation list-unstyled'>");
currentTestPartNode.getChildren().forEach((node) -> renderNavigation(renderer, sb, component, node, ubu, translator, options));
sb.append("</ul>");
}
sb.append("</div>");
}
Aggregations