Search in sources :

Example 51 with TestPlanNode

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>");
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 52 with TestPlanNode

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 });
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) ParentPartItemRefs(org.olat.ims.qti21.model.ParentPartItemRefs) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) OLATResourceable(org.olat.core.id.OLATResourceable) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) AssessmentItemCorrection(org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)

Example 53 with TestPlanNode

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

Example 54 with TestPlanNode

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>");
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode)

Aggregations

TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)54 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)32 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)26 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)22 Date (java.util.Date)16 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)16 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)14 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)10 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)10 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)10 TestPlan (uk.ac.ed.ph.jqtiplus.state.TestPlan)10 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)8 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)8 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)8 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)8 QtiCandidateStateException (uk.ac.ed.ph.jqtiplus.exception.QtiCandidateStateException)7 OLATResourceable (org.olat.core.id.OLATResourceable)6 ParentPartItemRefs (org.olat.ims.qti21.model.ParentPartItemRefs)6 CandidateTestEventType (org.olat.ims.qti21.model.audit.CandidateTestEventType)6