Search in sources :

Example 91 with Item

use of org.olat.ims.qti.editor.beecom.objects.Item in project openolat by klemens.

the class QTI12AssessmentStatisticsController method getMaxScoreSetting.

private Float getMaxScoreSetting(QTICourseNode testNode, List<Item> items) {
    Float maxScoreSetting;
    if (QTIType.test.equals(type)) {
        Object maxScoreObj = testNode.getModuleConfiguration().get(IQEditController.CONFIG_KEY_MAXSCORE);
        if (maxScoreObj instanceof Float) {
            maxScoreSetting = (Float) maxScoreObj;
        } else {
            // try to calculate max
            float max = 0;
            for (Item item : items) {
                if (item.getQuestion() != null) {
                    max += item.getQuestion().getMaxValue();
                }
            }
            maxScoreSetting = max > 0 ? max : null;
        }
    } else {
        maxScoreSetting = null;
    }
    return maxScoreSetting;
}
Also used : StatisticSurveyItem(org.olat.ims.qti.statistics.model.StatisticSurveyItem) Item(org.olat.ims.qti.editor.beecom.objects.Item) StatisticItem(org.olat.ims.qti.statistics.model.StatisticItem)

Example 92 with Item

use of org.olat.ims.qti.editor.beecom.objects.Item in project openolat by klemens.

the class QTI12To21Converter method isConvertible.

public static boolean isConvertible(OLATResource resource) {
    if (TestFileResource.TYPE_NAME.equals(resource.getResourceableTypeName())) {
        if (OnyxModule.isOnyxTest(resource)) {
            return true;
        }
        QTIDocument doc = TestFileResource.getQTIDocument(resource);
        if (doc == null) {
            return false;
        }
        boolean alien = false;
        @SuppressWarnings("unchecked") List<Item> items = doc.getAssessment().getItems();
        for (int i = 0; i < items.size(); i++) {
            Item item = items.get(i);
            alien |= item.isAlient();
        }
        return !alien;
    }
    return false;
}
Also used : QTIDocument(org.olat.ims.qti.editor.beecom.objects.QTIDocument) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) Item(org.olat.ims.qti.editor.beecom.objects.Item) VFSItem(org.olat.core.util.vfs.VFSItem)

Aggregations

Item (org.olat.ims.qti.editor.beecom.objects.Item)92 VFSItem (org.olat.core.util.vfs.VFSItem)38 Section (org.olat.ims.qti.editor.beecom.objects.Section)28 ArrayList (java.util.ArrayList)24 VFSContainer (org.olat.core.util.vfs.VFSContainer)18 Control (org.olat.ims.qti.editor.beecom.objects.Control)18 Element (org.dom4j.Element)16 Assessment (org.olat.ims.qti.editor.beecom.objects.Assessment)16 ChoiceQuestion (org.olat.ims.qti.editor.beecom.objects.ChoiceQuestion)16 Translator (org.olat.core.gui.translator.Translator)14 FIBResponse (org.olat.ims.qti.editor.beecom.objects.FIBResponse)14 Response (org.olat.ims.qti.editor.beecom.objects.Response)14 ItemNode (org.olat.ims.qti.editor.tree.ItemNode)14 File (java.io.File)12 QuestionItem (org.olat.modules.qpool.QuestionItem)12 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)10 FIBQuestion (org.olat.ims.qti.editor.beecom.objects.FIBQuestion)10 GenericQtiNode (org.olat.ims.qti.editor.tree.GenericQtiNode)10 SectionNode (org.olat.ims.qti.editor.tree.SectionNode)10 StatisticItem (org.olat.ims.qti.statistics.model.StatisticItem)10