Search in sources :

Example 11 with CorrectionIdentityAssessmentItemRow

use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow in project openolat by klemens.

the class CorrectionIdentityAssessmentItemListController method updatePreviousNext.

private void updatePreviousNext() {
    if (identityItemCtrl != null) {
        List<CorrectionIdentityAssessmentItemRow> rows = tableModel.getObjects();
        AssessmentItemListEntry itemSession = identityItemCtrl.getAssessmentItemSession();
        String previousText = translate("previous.item");
        String nextText = translate("next.item");
        boolean previousEnable = false;
        boolean nextEnable = false;
        int index = rows.indexOf(itemSession);
        if (index - 1 >= 0 && rows.size() > index - 1) {
            previousText = rows.get(index - 1).getLabel();
            previousEnable = true;
        }
        if (index + 1 >= 0 && rows.size() > index + 1) {
            nextText = rows.get(index + 1).getLabel();
            nextEnable = true;
        }
        identityItemCtrl.updatePreviousNext(previousText, previousEnable, nextText, nextEnable);
    }
}
Also used : CorrectionIdentityAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow) AssessmentItemListEntry(org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry)

Example 12 with CorrectionIdentityAssessmentItemRow

use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow 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)

Aggregations

CorrectionIdentityAssessmentItemRow (org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow)8 ArrayList (java.util.ArrayList)4 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)4 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)4 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)4 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)4 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)4 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)4 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)4 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)4 HashMap (java.util.HashMap)2 List (java.util.List)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 ParentPartItemRefs (org.olat.ims.qti21.model.ParentPartItemRefs)2 ManifestMetadataBuilder (org.olat.ims.qti21.model.xml.ManifestMetadataBuilder)2 IdentityItemCols (org.olat.ims.qti21.ui.assessment.CorrectionIdentityAssessmentItemTableModel.IdentityItemCols)2 AssessmentItemCorrection (org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection)2 AssessmentItemListEntry (org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry)2 CorrectionRow (org.olat.ims.qti21.ui.assessment.model.CorrectionRow)2