Search in sources :

Example 1 with AssessmentItemListEntry

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

the class CorrectionAssessmentItemListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            CorrectionAssessmentItemRow row = tableModel.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                // accept all
                doSelect(ureq, row, r -> true);
            } else if ("answered".equals(cmd)) {
                // accept all
                doSelect(ureq, row, new ResponsedPredicate(row, true));
            } else if ("notAnswered".equals(cmd)) {
                // accept all
                doSelect(ureq, row, new ResponsedPredicate(row, false));
            } else if ("autoCorrected".equals(cmd)) {
                doSelect(ureq, row, entry -> !row.isManualCorrection() && entry.getManualScore() == null);
            } else if ("corrected".equals(cmd)) {
                doSelect(ureq, row, entry -> entry.getManualScore() != null);
            } else if ("notCorrected".equals(cmd)) {
                doSelect(ureq, row, entry -> row.isManualCorrection() && entry.getManualScore() == null);
            } else if ("toReview".equals(cmd)) {
                doSelect(ureq, row, AssessmentItemListEntry::isToReview);
            }
        }
    } else if (saveTestsButton == source) {
        doConfirmSaveTests(ureq);
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        if ("tools".equals(link.getCmd())) {
            doOpenTools(ureq, (CorrectionAssessmentItemRow) link.getUserObject(), link);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Util(org.olat.core.util.Util) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) ItemSessionKey(org.olat.ims.qti21.ui.assessment.model.ItemSessionKey) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) AssessmentItemCorrection(org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection) OLATResourceable(org.olat.core.id.OLATResourceable) BigDecimal(java.math.BigDecimal) OresHelper(org.olat.core.util.resource.OresHelper) Map(java.util.Map) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) QuestionTypeFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.QuestionTypeFlexiCellRenderer) QTI21Module(org.olat.ims.qti21.QTI21Module) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ManifestMetadataBuilder(org.olat.ims.qti21.model.xml.ManifestMetadataBuilder) Translator(org.olat.core.gui.translator.Translator) Predicate(java.util.function.Predicate) WindowControl(org.olat.core.gui.control.WindowControl) PopEvent(org.olat.core.gui.components.stack.PopEvent) Component(org.olat.core.gui.components.Component) LinkFactory(org.olat.core.gui.components.link.LinkFactory) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus) QTI21Service(org.olat.ims.qti21.QTI21Service) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) BasicController(org.olat.core.gui.control.controller.BasicController) CorrectionAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) CorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.CorrectedFlexiCellRenderer) Identity(org.olat.core.id.Identity) AssessmentTestComposerController(org.olat.ims.qti21.ui.editor.AssessmentTestComposerController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) SelectAssessmentItemEvent(org.olat.ims.qti21.ui.assessment.event.SelectAssessmentItemEvent) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) ToReviewFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.ToReviewFlexiCellRenderer) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) HashMap(java.util.HashMap) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) ArrayList(java.util.ArrayList) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) CorrectionWorkflow(org.olat.ims.qti21.QTI21Module.CorrectionWorkflow) AssessmentItemListEntry(org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) Link(org.olat.core.gui.components.link.Link) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey) CompleteAssessmentTestSessionEvent(org.olat.modules.assessment.ui.event.CompleteAssessmentTestSessionEvent) ItemCols(org.olat.ims.qti21.ui.assessment.CorrectionAssessmentItemTableModel.ItemCols) AutoCorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.AutoCorrectedFlexiCellRenderer) Controller(org.olat.core.gui.control.Controller) UserManager(org.olat.user.UserManager) NotCorrectedFlexiCellRenderer(org.olat.ims.qti21.ui.assessment.components.NotCorrectedFlexiCellRenderer) LockResult(org.olat.core.util.coordinate.LockResult) UserRequest(org.olat.core.gui.UserRequest) CoordinatorManager(org.olat.core.util.coordinate.CoordinatorManager) CorrectionAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow) AssessmentItemListEntry(org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 2 with AssessmentItemListEntry

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

the class CorrectionAssessmentItemListController method updatePreviousNext.

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

Example 3 with AssessmentItemListEntry

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

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

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 5 with AssessmentItemListEntry

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

the class CorrectionIdentityAssessmentItemNavigationController method doSelectByIndex.

private void doSelectByIndex(UserRequest ureq, int index) {
    List<? extends AssessmentItemListEntry> assessmentEntryList = getAssessmentEntryList();
    if (index >= 0 && index < assessmentEntryList.size()) {
        AssessmentItemListEntry nextEntry = assessmentEntryList.get(index);
        fireEvent(ureq, new SelectAssessmentItemEvent(nextEntry));
    }
}
Also used : SelectAssessmentItemEvent(org.olat.ims.qti21.ui.assessment.event.SelectAssessmentItemEvent) AssessmentItemListEntry(org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry)

Aggregations

AssessmentItemListEntry (org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry)14 SelectAssessmentItemEvent (org.olat.ims.qti21.ui.assessment.event.SelectAssessmentItemEvent)8 Identity (org.olat.core.id.Identity)6 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)6 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)6 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)6 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 AssessmentItemCorrection (org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection)3 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)3 TestPlanNode (uk.ac.ed.ph.jqtiplus.state.TestPlanNode)3 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)3 BigDecimal (java.math.BigDecimal)2 List (java.util.List)2 Map (java.util.Map)2 Predicate (java.util.function.Predicate)2 UserRequest (org.olat.core.gui.UserRequest)2 Component (org.olat.core.gui.components.Component)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2