Search in sources :

Example 1 with CorrectionAssessmentItemRow

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

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

the class CorrectionAssessmentItemListController method doConfirmSaveTests.

private void doConfirmSaveTests(UserRequest ureq) {
    int notCorrectedQuestions = 0;
    List<CorrectionAssessmentItemRow> rows = tableModel.getObjects();
    for (CorrectionAssessmentItemRow row : rows) {
        notCorrectedQuestions += row.getNumNotCorrected();
    }
    confirmSaveTestCtrl = new ConfirmSaveTestsController(ureq, getWindowControl(), notCorrectedQuestions > 0);
    listenTo(confirmSaveTestCtrl);
    cmc = new CloseableModalController(getWindowControl(), "close", confirmSaveTestCtrl.getInitialComponent(), true, translate("save.tests"));
    listenTo(cmc);
    cmc.activate();
}
Also used : CorrectionAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)

Example 3 with CorrectionAssessmentItemRow

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

the class CorrectionAssessmentItemTableSort method sort.

@Override
protected void sort(List<CorrectionAssessmentItemRow> rows) {
    int columnIndex = getColumnIndex();
    ItemCols column = ItemCols.values()[columnIndex];
    switch(column) {
        case itemType:
            Collections.sort(rows, new QuestionTypeComparator());
            break;
        case corrected:
            Collections.sort(rows, new CorrectedComparator());
            break;
        case notCorrected:
            Collections.sort(rows, new NotCorrectedComparator());
            break;
        default:
            super.sort(rows);
    }
}
Also used : ItemCols(org.olat.ims.qti21.ui.assessment.CorrectionAssessmentItemTableModel.ItemCols)

Example 4 with CorrectionAssessmentItemRow

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

the class CorrectionAssessmentItemListController method doConfirmSaveTests.

private void doConfirmSaveTests(UserRequest ureq) {
    int notCorrectedQuestions = 0;
    List<CorrectionAssessmentItemRow> rows = tableModel.getObjects();
    for (CorrectionAssessmentItemRow row : rows) {
        notCorrectedQuestions += row.getNumNotCorrected();
    }
    confirmSaveTestCtrl = new ConfirmSaveTestsController(ureq, getWindowControl(), notCorrectedQuestions > 0);
    listenTo(confirmSaveTestCtrl);
    cmc = new CloseableModalController(getWindowControl(), "close", confirmSaveTestCtrl.getInitialComponent(), true, translate("save.tests"));
    listenTo(cmc);
    cmc.activate();
}
Also used : CorrectionAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)

Example 5 with CorrectionAssessmentItemRow

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

the class CorrectionAssessmentItemListController method loadModel.

private void loadModel(boolean reset, boolean lastSessions) {
    if (lastSessions) {
        model.loadLastSessions();
    }
    ResolvedAssessmentTest resolvedAssessmentTest = model.getResolvedAssessmentTest();
    List<AssessmentItemRef> itemRefs = resolvedAssessmentTest.getAssessmentItemRefs();
    List<CorrectionAssessmentItemRow> itemRows = new ArrayList<>(itemRefs.size());
    Map<String, CorrectionAssessmentItemRow> itemRefIdToRows = new HashMap<>();
    for (AssessmentItemRef itemRef : itemRefs) {
        ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
        AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
        ManifestMetadataBuilder metadata = model.getMetadata(itemRef);
        FormLink toolsLink = uifactory.addFormLink("tools_" + (++counter), "tools", "", null, null, Link.NONTRANSLATED);
        toolsLink.setIconLeftCSS("o_icon o_icon_actions o_icon-lg");
        CorrectionAssessmentItemRow itemRow = new CorrectionAssessmentItemRow(itemRef, assessmentItem, metadata, toolsLink);
        toolsLink.setUserObject(itemRow);
        itemRows.add(itemRow);
        itemRefIdToRows.put(itemRef.getIdentifier().toString(), itemRow);
    }
    List<AssessmentItemSession> itemSessions = qtiService.getAssessmentItemSessions(model.getCourseEntry(), model.getSubIdent(), model.getTestEntry(), null);
    Map<ItemSessionKey, AssessmentItemSession> itemSessionMap = new HashMap<>();
    for (AssessmentItemSession itemSession : itemSessions) {
        AssessmentTestSession candidateSession = itemSession.getAssessmentTestSession();
        if (model.getReversedLastSessions().containsKey(candidateSession)) {
            // the map contains all test sessions the user is allowed to correct
            String itemRefIdentifier = itemSession.getAssessmentItemIdentifier();
            itemSessionMap.put(new ItemSessionKey(candidateSession.getKey(), itemRefIdentifier), itemSession);
        }
    }
    for (Map.Entry<Identity, AssessmentTestSession> entry : model.getLastSessions().entrySet()) {
        if (model.getLastSessions().containsKey(entry.getKey())) {
            TestSessionState testSessionState = model.getTestSessionStates().get(entry.getKey());
            for (Map.Entry<TestPlanNodeKey, ItemSessionState> itemEntry : testSessionState.getItemSessionStates().entrySet()) {
                String itemRefIdentifier = itemEntry.getKey().getIdentifier().toString();
                CorrectionAssessmentItemRow row = itemRefIdToRows.get(itemRefIdentifier);
                if (row != null) {
                    AssessmentItemSession itemSession = itemSessionMap.get(new ItemSessionKey(entry.getValue().getKey(), itemRefIdentifier));
                    appendStatistics(row, itemSession, itemEntry.getValue());
                }
            }
        }
    }
    tableModel.setObjects(itemRows);
    tableEl.reset(reset, reset, true);
}
Also used : TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) ItemSessionKey(org.olat.ims.qti21.ui.assessment.model.ItemSessionKey) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) Identity(org.olat.core.id.Identity) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) ManifestMetadataBuilder(org.olat.ims.qti21.model.xml.ManifestMetadataBuilder) CorrectionAssessmentItemRow(org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) Map(java.util.Map) HashMap(java.util.HashMap) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Aggregations

ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 Identity (org.olat.core.id.Identity)6 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)6 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)6 CorrectionAssessmentItemRow (org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow)6 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)6 Map (java.util.Map)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 ManifestMetadataBuilder (org.olat.ims.qti21.model.xml.ManifestMetadataBuilder)4 AssessmentItemListEntry (org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry)4 ItemSessionKey (org.olat.ims.qti21.ui.assessment.model.ItemSessionKey)4 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)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 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)4 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)3 ItemCols (org.olat.ims.qti21.ui.assessment.CorrectionAssessmentItemTableModel.ItemCols)3