Search in sources :

Example 11 with NumericalEntry

use of org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.NumericalEntry in project openolat by klemens.

the class QTI21StatisticsManagerImpl method getNumericalInputInteractionSettings.

private NumericalInputInteractionStatistics getNumericalInputInteractionSettings(Identifier responseIdentifier, ResponseDeclaration responseDeclaration, AssessmentItem item) {
    NumericalEntry numericalEntry = new NumericalEntry(responseIdentifier);
    FIBAssessmentItemBuilder.extractNumericalEntrySettings(item, numericalEntry, responseDeclaration, new AtomicInteger(), new DoubleAdder());
    String correctResponse = "";
    Double solution = numericalEntry.getSolution();
    if (numericalEntry.getSolution() != null) {
        correctResponse = solution.toString();
    }
    double points = Double.NaN;
    if (numericalEntry.getScore() == null) {
        // all score
        points = 0.0d;
    } else {
        points = numericalEntry.getScore().doubleValue();
    }
    return new NumericalInputInteractionStatistics(responseIdentifier, correctResponse, solution, numericalEntry.getToleranceMode(), numericalEntry.getLowerTolerance(), numericalEntry.getUpperTolerance(), points);
}
Also used : DoubleAdder(java.util.concurrent.atomic.DoubleAdder) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NumericalEntry(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.NumericalEntry) NumericalInputInteractionStatistics(org.olat.ims.qti21.model.statistics.NumericalInputInteractionStatistics)

Example 12 with NumericalEntry

use of org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.NumericalEntry in project openolat by klemens.

the class CorrectResponsesUtil method getCorrectTextResponses.

public static final AbstractEntry getCorrectTextResponses(AssessmentItem assessmentItem, TextEntryInteraction interaction) {
    ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(interaction.getResponseIdentifier());
    if (responseDeclaration.hasBaseType(BaseType.STRING) && responseDeclaration.hasCardinality(Cardinality.SINGLE)) {
        TextEntry textEntry = new TextEntry(interaction);
        FIBAssessmentItemBuilder.extractTextEntrySettingsFromResponseDeclaration(textEntry, responseDeclaration, new AtomicInteger(), new DoubleAdder());
        return textEntry;
    } else if (responseDeclaration.hasBaseType(BaseType.FLOAT) && responseDeclaration.hasCardinality(Cardinality.SINGLE)) {
        NumericalEntry numericalEntry = new NumericalEntry(interaction);
        FIBAssessmentItemBuilder.extractNumericalEntrySettings(assessmentItem, numericalEntry, responseDeclaration, new AtomicInteger(), new DoubleAdder());
        return numericalEntry;
    }
    return null;
}
Also used : DoubleAdder(java.util.concurrent.atomic.DoubleAdder) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) TextEntry(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.TextEntry) ResponseDeclaration(uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration) NumericalEntry(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.NumericalEntry)

Aggregations

NumericalEntry (org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.NumericalEntry)8 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6 DoubleAdder (java.util.concurrent.atomic.DoubleAdder)6 TextEntry (org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.TextEntry)6 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)6 AssessmentItemFactory.createNumericalEntryResponseDeclaration (org.olat.ims.qti21.model.xml.AssessmentItemFactory.createNumericalEntryResponseDeclaration)4 AssessmentItemFactory.createTextEntryResponseDeclaration (org.olat.ims.qti21.model.xml.AssessmentItemFactory.createTextEntryResponseDeclaration)4 AbstractEntry (org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.AbstractEntry)4 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 NumericalInputInteractionStatistics (org.olat.ims.qti21.model.statistics.NumericalInputInteractionStatistics)2 AssessmentItemFactory.appendTextEntryInteraction (org.olat.ims.qti21.model.xml.AssessmentItemFactory.appendTextEntryInteraction)2 Interaction (uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction)2 TextEntryInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.TextEntryInteraction)2