Search in sources :

Example 51 with ResolvedAssessmentItem

use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project openolat by klemens.

the class AssessmentTestComposerController method recalculateMaxScoreAssessmentTest.

private void recalculateMaxScoreAssessmentTest(Map<AssessmentItemRef, AssessmentItem> flyingObjects) {
    DoubleAdder atomicMaxScore = new DoubleAdder();
    AssessmentTest assessmentTest = (AssessmentTest) menuTree.getTreeModel().getRootNode().getUserObject();
    AssessmentTestHelper.visit(assessmentTest, new AssessmentTestVisitor() {

        @Override
        public void visit(TestPart testPart) {
        /* */
        }

        @Override
        public void visit(SectionPart sectionPart) {
            if (sectionPart instanceof AssessmentItemRef) {
                AssessmentItemRef itemRef = (AssessmentItemRef) sectionPart;
                ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
                checkAndFixAbsolutePath(itemRef);
                AssessmentItem assessmentItem = null;
                if (resolvedAssessmentItem != null) {
                    assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
                }
                if (assessmentItem == null && flyingObjects != null && flyingObjects.containsKey(itemRef)) {
                    assessmentItem = flyingObjects.get(itemRef);
                }
                if (assessmentItem != null) {
                    Double maxScore = QtiNodesExtractor.extractMaxScore(assessmentItem);
                    if (maxScore != null) {
                        atomicMaxScore.add(maxScore.doubleValue());
                    }
                }
            }
        }
    });
    double sumMaxScore = atomicMaxScore.sum();
    if (sumMaxScore > 0.0d) {
        assessmentTestBuilder.setMaxScore(sumMaxScore);
    } else {
        assessmentTestBuilder.setMaxScore(null);
    }
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) DoubleAdder(java.util.concurrent.atomic.DoubleAdder) SectionPart(uk.ac.ed.ph.jqtiplus.node.test.SectionPart) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) AssessmentTestVisitor(org.olat.ims.qti21.AssessmentTestHelper.AssessmentTestVisitor)

Example 52 with ResolvedAssessmentItem

use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project openolat by klemens.

the class FeedbackResultComponentRenderer method render.

@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
    FeedbackResultComponent cmp = (FeedbackResultComponent) source;
    ResolvedAssessmentItem resolvedAssessmentItem = cmp.getResolvedAssessmentItem();
    ItemSessionState itemSessionState = cmp.getItemSessionState();
    AssessmentRenderer assessmentRenderer = new AssessmentRenderer(renderer);
    AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
    for (ModalFeedback modalFeedback : assessmentItem.getModalFeedbacks()) {
        Identifier outcomeIdentifier = modalFeedback.getOutcomeIdentifier();
        if (QTI21Constants.CORRECT_SOLUTION_IDENTIFIER.equals(outcomeIdentifier)) {
            sb.append("<div class='modalFeedback'>");
            renderAssessmentItemCorrectSolutionModalFeedback(assessmentRenderer, sb, modalFeedback, cmp, resolvedAssessmentItem, itemSessionState, ubu, translator);
            sb.append("</div>");
        }
    }
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback)

Example 53 with ResolvedAssessmentItem

use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project openolat by klemens.

the class CorrectionOverviewModel method isManualCorrection.

public boolean isManualCorrection(AssessmentItemRef itemRef) {
    String identifier = itemRef.getIdentifier().toString();
    return manualCorrections.computeIfAbsent(identifier, id -> {
        ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
        AssessmentItem item = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
        List<Interaction> interactions = item.getItemBody().findInteractions();
        for (Interaction interaction : interactions) {
            if (interaction instanceof UploadInteraction || interaction instanceof DrawingInteraction || interaction instanceof ExtendedTextInteraction) {
                return true;
            }
        }
        return false;
    });
}
Also used : UploadInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.UploadInteraction) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) UploadInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.UploadInteraction) Interaction(uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction) DrawingInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) DrawingInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction)

Example 54 with ResolvedAssessmentItem

use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project OpenOLAT by OpenOLAT.

the class AssessmentItemCheckerTest method loadAssessmentItem.

private AssessmentItem loadAssessmentItem(URL itemUrl) throws URISyntaxException {
    QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
    ResourceLocator fileResourceLocator = new PathResourceLocator(Paths.get(itemUrl.toURI()));
    AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
    ResolvedAssessmentItem item = assessmentObjectXmlLoader.loadAndResolveAssessmentItem(itemUrl.toURI());
    return item.getItemLookup().getRootNodeHolder().getRootNode();
}
Also used : AssessmentObjectXmlLoader(uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader) QtiXmlReader(uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader) JqtiExtensionManager(uk.ac.ed.ph.jqtiplus.JqtiExtensionManager) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) ResourceLocator(uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)

Example 55 with ResolvedAssessmentItem

use of uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem in project OpenOLAT by OpenOLAT.

the class HottextAssessmentItemBuilderTest method loadAssessmentItem.

private AssessmentItem loadAssessmentItem(URL itemUrl) throws URISyntaxException {
    QtiXmlReader qtiXmlReader = new QtiXmlReader(new JqtiExtensionManager());
    ResourceLocator fileResourceLocator = new PathResourceLocator(Paths.get(itemUrl.toURI()));
    AssessmentObjectXmlLoader assessmentObjectXmlLoader = new AssessmentObjectXmlLoader(qtiXmlReader, fileResourceLocator);
    ResolvedAssessmentItem item = assessmentObjectXmlLoader.loadAndResolveAssessmentItem(itemUrl.toURI());
    return item.getItemLookup().getRootNodeHolder().getRootNode();
}
Also used : AssessmentObjectXmlLoader(uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader) QtiXmlReader(uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader) JqtiExtensionManager(uk.ac.ed.ph.jqtiplus.JqtiExtensionManager) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) ResourceLocator(uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator) PathResourceLocator(org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)

Aggregations

ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)106 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)76 File (java.io.File)38 URI (java.net.URI)32 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)26 AssessmentObjectXmlLoader (uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader)26 QtiXmlReader (uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader)26 ResourceLocator (uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator)26 PathResourceLocator (org.olat.fileresource.types.ImsQTI21Resource.PathResourceLocator)22 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)22 IOException (java.io.IOException)20 JqtiExtensionManager (uk.ac.ed.ph.jqtiplus.JqtiExtensionManager)20 URISyntaxException (java.net.URISyntaxException)16 ManifestMetadataBuilder (org.olat.ims.qti21.model.xml.ManifestMetadataBuilder)16 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)14 ArrayList (java.util.ArrayList)12 ManifestBuilder (org.olat.ims.qti21.model.xml.ManifestBuilder)12 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)12 BadResourceException (uk.ac.ed.ph.jqtiplus.provision.BadResourceException)12 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)12