Search in sources :

Example 51 with SimpleAssociableChoice

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice in project openolat by klemens.

the class TrueFalseEditorController method doAddSourceRow.

private void doAddSourceRow(UserRequest ureq) {
    SimpleAssociableChoice newChoice = createSimpleAssociableChoice("Text", itemBuilder.getSourceMatchSet());
    itemBuilder.getSourceMatchSet().getSimpleAssociableChoices().add(newChoice);
    wrapSource(ureq, newChoice, sourceWrappers);
    answersCont.setDirty(true);
}
Also used : AssessmentItemFactory.createSimpleAssociableChoice(org.olat.ims.qti21.model.xml.AssessmentItemFactory.createSimpleAssociableChoice) SimpleAssociableChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice)

Example 52 with SimpleAssociableChoice

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice in project openolat by klemens.

the class TrueFalseEditorController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (readOnly)
        return;
    // title
    itemBuilder.setTitle(titleEl.getValue());
    // question
    String questionText = textEl.getRawValue();
    itemBuilder.setQuestion(questionText);
    if (!restrictedEdit) {
        itemBuilder.setMultipleChoice(false);
        itemBuilder.setShuffle(false);
    }
    // update
    for (SourceWrapper sourceWrapper : sourceWrappers) {
        SimpleAssociableChoice choice = sourceWrapper.getSimpleChoice();
        String answer = sourceWrapper.getText().getRawValue();
        itemBuilder.getHtmlHelper().appendHtml(choice, answer);
    }
    // correct answers
    commitAssociations(ureq);
    fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), QTI21QuestionType.match));
}
Also used : AssessmentItemFactory.createSimpleAssociableChoice(org.olat.ims.qti21.model.xml.AssessmentItemFactory.createSimpleAssociableChoice) SimpleAssociableChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice) AssessmentItemEvent(org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)

Example 53 with SimpleAssociableChoice

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice in project openolat by klemens.

the class KPrimEditorController method updateMatch.

private void updateMatch(UserRequest ureq) {
    for (KprimWrapper choiceWrapper : choiceWrappers) {
        SimpleAssociableChoice choice = choiceWrapper.getSimpleChoice();
        Identifier choiceIdentifier = choice.getIdentifier();
        String association = ureq.getHttpReq().getParameter(choiceIdentifier.toString());
        if (StringHelper.containsNonWhitespace(association)) {
            if ("correct".equals(association)) {
                itemBuilder.setAssociation(choiceIdentifier, QTI21Constants.CORRECT_IDENTIFIER);
            } else if ("wrong".equals(association)) {
                itemBuilder.setAssociation(choiceIdentifier, QTI21Constants.WRONG_IDENTIFIER);
            }
        }
    }
}
Also used : SimpleAssociableChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier)

Example 54 with SimpleAssociableChoice

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice in project openolat by klemens.

the class KPrimStatisticsController method getKPrim.

public Series getKPrim() {
    List<KPrimStatistics> statisticResponses = qtiStatisticsManager.getKPrimStatistics(itemRef.getIdentifier().toString(), assessmentItem, interaction, resourceResult.getSearchParams());
    // TODO String mediaBaseURL = resourceResult.getMediaBaseURL();
    boolean survey = QTIType.survey.equals(resourceResult.getType());
    int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
    List<SimpleMatchSet> matchSets = interaction.getSimpleMatchSets();
    SimpleMatchSet fourMatchSet = matchSets.get(0);
    int i = 0;
    BarSeries d1 = new BarSeries("bar_green", "green", translate("answer.correct"));
    BarSeries d2 = new BarSeries("bar_red", "red", translate("answer.false"));
    BarSeries d3 = new BarSeries("bar_grey", "grey", translate("answer.noanswer"));
    List<ResponseInfos> responseInfos = new ArrayList<>();
    for (KPrimStatistics statisticResponse : statisticResponses) {
        Identifier choiceIdentifier = statisticResponse.getChoiceIdentifier();
        boolean correctRight = statisticResponse.isCorrectRight();
        double right = statisticResponse.getNumOfCorrect();
        double wrong = statisticResponse.getNumOfIncorrect();
        double notanswered = numOfParticipants - right - wrong;
        String label = Integer.toString(++i);
        d1.add(right, label);
        d2.add(wrong, label);
        d3.add(notanswered, label);
        String text = "";
        for (SimpleAssociableChoice choice : fourMatchSet.getSimpleAssociableChoices()) {
            if (choice.getIdentifier().equals(choiceIdentifier)) {
                String textFlow = assessmentHtmlBuilder.flowStaticString(choice.getFlowStatics());
                text = Formatter.formatLatexFormulas(textFlow);
            }
        }
        responseInfos.add(new ResponseInfos(label, text, null, correctRight, survey, true));
    }
    List<BarSeries> serieList = new ArrayList<>(3);
    serieList.add(d1);
    serieList.add(d2);
    serieList.add(d3);
    Series series = new Series(serieList, responseInfos, numOfParticipants, !survey);
    series.setChartType(survey ? SeriesFactory.BAR_ANSWERED : SeriesFactory.BAR_CORRECT_WRONG_NOT);
    series.setItemCss("o_mi_qtikprim");
    return series;
}
Also used : SimpleAssociableChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice) ArrayList(java.util.ArrayList) BarSeries(org.olat.core.gui.components.chart.BarSeries) KPrimStatistics(org.olat.ims.qti21.model.statistics.KPrimStatistics) SimpleMatchSet(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleMatchSet) Series(org.olat.ims.qti.statistics.ui.Series) BarSeries(org.olat.core.gui.components.chart.BarSeries) ResponseInfos(org.olat.ims.qti.statistics.ui.ResponseInfos) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier)

Aggregations

SimpleAssociableChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice)54 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)20 MatchInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction)18 ArrayList (java.util.ArrayList)17 SimpleMatchSet (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleMatchSet)16 AssessmentItemFactory.createSimpleAssociableChoice (org.olat.ims.qti21.model.xml.AssessmentItemFactory.createSimpleAssociableChoice)14 HashMap (java.util.HashMap)12 List (java.util.List)10 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)10 AssessmentItemEvent (org.olat.ims.qti21.ui.editor.events.AssessmentItemEvent)10 P (uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P)10 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)10 FlowFormItem (org.olat.ims.qti21.ui.components.FlowFormItem)7 DirectedPairValue (uk.ac.ed.ph.jqtiplus.value.DirectedPairValue)7 Map (java.util.Map)6 Collectors (java.util.stream.Collectors)6 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)6 File (java.io.File)4 UserRequest (org.olat.core.gui.UserRequest)4 FormItem (org.olat.core.gui.components.form.flexible.FormItem)4