Search in sources :

Example 1 with AssessmentItemCorrection

use of org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection in project OpenOLAT by OpenOLAT.

the class CorrectionAssessmentItemListController method doSelect.

private void doSelect(UserRequest ureq, AssessmentItemListEntry listEntry, List<? extends AssessmentItemListEntry> selectedItemSessions) {
    removeAsListenerAndDispose(identityItemCtrl);
    doUnlock();
    AssessmentItemRef itemRef = listEntry.getItemRef();
    AssessmentItemSession reloadItemSession = null;
    if (listEntry.getItemSession() != null) {
        reloadItemSession = qtiService.getAssessmentItemSession(listEntry.getItemSession());
    }
    // lock on item, need to check the lock on identity / test
    String lockSubKey = "item-" + listEntry.getAssessedIdentity().getKey() + "-" + listEntry.getItemRef().getIdentifier().toString();
    OLATResourceable testOres = OresHelper.clone(model.getTestEntry().getOlatResource());
    lockResult = CoordinatorManager.getInstance().getCoordinator().getLocker().acquireLock(testOres, getIdentity(), lockSubKey);
    if (lockResult.isSuccess()) {
        Identity assessedIdentity = listEntry.getAssessedIdentity();
        AssessmentTestSession candidateSession = listEntry.getTestSession();
        TestSessionState testSessionState = qtiService.loadTestSessionState(listEntry.getTestSession());
        List<TestPlanNode> nodes = testSessionState.getTestPlan().getNodes(itemRef.getIdentifier());
        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);
            identityItemCtrl = new CorrectionIdentityAssessmentItemNavigationController(ureq, getWindowControl(), model.getTestEntry(), model.getResolvedAssessmentTest(), itemCorrection, listEntry, selectedItemSessions, model);
            listenTo(identityItemCtrl);
            updatePreviousNext();
            stackPanel.pushController(listEntry.getLabel(), identityItemCtrl);
        }
    } 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) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) AssessmentItemCorrection(org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection) Identity(org.olat.core.id.Identity)

Example 2 with AssessmentItemCorrection

use of org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection in project OpenOLAT by OpenOLAT.

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 3 with AssessmentItemCorrection

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

the class CorrectionAssessmentItemListController method doSelect.

private void doSelect(UserRequest ureq, AssessmentItemListEntry listEntry, List<? extends AssessmentItemListEntry> selectedItemSessions) {
    removeAsListenerAndDispose(identityItemCtrl);
    doUnlock();
    AssessmentItemRef itemRef = listEntry.getItemRef();
    AssessmentItemSession reloadItemSession = null;
    if (listEntry.getItemSession() != null) {
        reloadItemSession = qtiService.getAssessmentItemSession(listEntry.getItemSession());
    }
    // lock on item, need to check the lock on identity / test
    String lockSubKey = "item-" + listEntry.getAssessedIdentity().getKey() + "-" + listEntry.getItemRef().getIdentifier().toString();
    OLATResourceable testOres = OresHelper.clone(model.getTestEntry().getOlatResource());
    lockResult = CoordinatorManager.getInstance().getCoordinator().getLocker().acquireLock(testOres, getIdentity(), lockSubKey);
    if (lockResult.isSuccess()) {
        Identity assessedIdentity = listEntry.getAssessedIdentity();
        AssessmentTestSession candidateSession = listEntry.getTestSession();
        TestSessionState testSessionState = qtiService.loadTestSessionState(listEntry.getTestSession());
        List<TestPlanNode> nodes = testSessionState.getTestPlan().getNodes(itemRef.getIdentifier());
        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);
            identityItemCtrl = new CorrectionIdentityAssessmentItemNavigationController(ureq, getWindowControl(), model.getTestEntry(), model.getResolvedAssessmentTest(), itemCorrection, listEntry, selectedItemSessions, model);
            listenTo(identityItemCtrl);
            updatePreviousNext();
            stackPanel.pushController(listEntry.getLabel(), identityItemCtrl);
        }
    } 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) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) AssessmentItemCorrection(org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection) Identity(org.olat.core.id.Identity)

Example 4 with AssessmentItemCorrection

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

OLATResourceable (org.olat.core.id.OLATResourceable)4 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)4 AssessmentItemCorrection (org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection)4 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)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 Identity (org.olat.core.id.Identity)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 ParentPartItemRefs (org.olat.ims.qti21.model.ParentPartItemRefs)2 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)2 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)2