Search in sources :

Example 1 with SimpleChoiceAssessmentItemBuilder

use of org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder in project OpenOLAT by OpenOLAT.

the class CSVToAssessmentItemConverter method processChoice_smc.

private void processChoice_smc(String[] parts, SimpleChoiceAssessmentItemBuilder choiceBuilder) {
    double point = parseFloat(parts[0], 1.0f);
    String content = parts[1];
    ChoiceInteraction interaction = choiceBuilder.getChoiceInteraction();
    SimpleChoice newChoice = AssessmentItemFactory.createSimpleChoice(interaction, content, choiceBuilder.getQuestionType().getPrefix());
    choiceBuilder.addSimpleChoice(newChoice);
    choiceBuilder.setMapping(newChoice.getIdentifier(), point);
    if (point > 0.0) {
        if (choiceBuilder instanceof MultipleChoiceAssessmentItemBuilder) {
            ((MultipleChoiceAssessmentItemBuilder) choiceBuilder).addCorrectAnswer(newChoice.getIdentifier());
        } else {
            ((SingleChoiceAssessmentItemBuilder) choiceBuilder).setCorrectAnswer(newChoice.getIdentifier());
        }
    }
}
Also used : SimpleChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleChoice) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder)

Example 2 with SimpleChoiceAssessmentItemBuilder

use of org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder in project OpenOLAT by OpenOLAT.

the class CSVToAssessmentItemConverter method processPoints.

private void processPoints(String[] parts) {
    if (currentItem == null)
        return;
    double points = parseFloat(parts[1], 1.0f);
    AssessmentItemBuilder itemBuilder = currentItem.getItemBuilder();
    if (itemBuilder instanceof SimpleChoiceAssessmentItemBuilder) {
        itemBuilder.setMinScore(0.0d);
        itemBuilder.setMaxScore(points);
    } else if (itemBuilder instanceof FIBAssessmentItemBuilder) {
        itemBuilder.setMinScore(0.0d);
        itemBuilder.setMaxScore(points);
    } else if (itemBuilder instanceof KPrimAssessmentItemBuilder) {
        itemBuilder.setMinScore(0.0d);
        itemBuilder.setMaxScore(points);
    } else if (itemBuilder instanceof MatchAssessmentItemBuilder) {
        itemBuilder.setMinScore(0.0d);
        itemBuilder.setMaxScore(points);
    }
}
Also used : SimpleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder) FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) SimpleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder) EssayAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder) FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) AssessmentItemBuilder(org.olat.ims.qti21.model.xml.AssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder)

Example 3 with SimpleChoiceAssessmentItemBuilder

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

the class CSVToAssessmentItemConverter method processChoice_smc.

private void processChoice_smc(String[] parts, SimpleChoiceAssessmentItemBuilder choiceBuilder) {
    double point = parseFloat(parts[0], 1.0f);
    String content = parts[1];
    ChoiceInteraction interaction = choiceBuilder.getChoiceInteraction();
    SimpleChoice newChoice = AssessmentItemFactory.createSimpleChoice(interaction, content, choiceBuilder.getQuestionType().getPrefix());
    choiceBuilder.addSimpleChoice(newChoice);
    choiceBuilder.setMapping(newChoice.getIdentifier(), point);
    if (point > 0.0) {
        if (choiceBuilder instanceof MultipleChoiceAssessmentItemBuilder) {
            ((MultipleChoiceAssessmentItemBuilder) choiceBuilder).addCorrectAnswer(newChoice.getIdentifier());
        } else {
            ((SingleChoiceAssessmentItemBuilder) choiceBuilder).setCorrectAnswer(newChoice.getIdentifier());
        }
    }
}
Also used : SimpleChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleChoice) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder)

Example 4 with SimpleChoiceAssessmentItemBuilder

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

the class CSVToAssessmentItemConverter method processPoints.

private void processPoints(String[] parts) {
    if (currentItem == null)
        return;
    double points = parseFloat(parts[1], 1.0f);
    AssessmentItemBuilder itemBuilder = currentItem.getItemBuilder();
    if (itemBuilder instanceof SimpleChoiceAssessmentItemBuilder) {
        itemBuilder.setMinScore(0.0d);
        itemBuilder.setMaxScore(points);
    } else if (itemBuilder instanceof FIBAssessmentItemBuilder) {
        itemBuilder.setMinScore(0.0d);
        itemBuilder.setMaxScore(points);
    } else if (itemBuilder instanceof KPrimAssessmentItemBuilder) {
        itemBuilder.setMinScore(0.0d);
        itemBuilder.setMaxScore(points);
    } else if (itemBuilder instanceof MatchAssessmentItemBuilder) {
        itemBuilder.setMinScore(0.0d);
        itemBuilder.setMaxScore(points);
    }
}
Also used : SimpleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder) FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) SimpleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder) EssayAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder) FIBAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder) SingleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder) AssessmentItemBuilder(org.olat.ims.qti21.model.xml.AssessmentItemBuilder) KPrimAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder) MultipleChoiceAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder) MatchAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder)

Aggregations

MultipleChoiceAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.MultipleChoiceAssessmentItemBuilder)4 SingleChoiceAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.SingleChoiceAssessmentItemBuilder)4 AssessmentItemBuilder (org.olat.ims.qti21.model.xml.AssessmentItemBuilder)2 EssayAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder)2 FIBAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder)2 KPrimAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.KPrimAssessmentItemBuilder)2 MatchAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.MatchAssessmentItemBuilder)2 SimpleChoiceAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.SimpleChoiceAssessmentItemBuilder)2 ChoiceInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction)2 SimpleChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleChoice)2