Search in sources :

Example 11 with ResponseInfos

use of org.olat.ims.qti.statistics.ui.ResponseInfos 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)

Example 12 with ResponseInfos

use of org.olat.ims.qti.statistics.ui.ResponseInfos in project openolat by klemens.

the class TextEntryInteractionsStatisticsController method getFIB.

private Series getFIB() {
    List<AbstractTextEntryInteractionStatistics> processedAnswers = qtiStatisticsManager.getTextEntryInteractionsStatistic(itemRef.getIdentifier().toString(), assessmentItem, interactions, resourceResult.getSearchParams());
    boolean survey = QTIType.survey.equals(resourceResult.getType());
    int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
    int i = 0;
    String cssColor = survey ? "bar_default" : "bar_green";
    String color = survey ? null : "green";
    BarSeries d1 = new BarSeries(cssColor, color, null);
    List<ResponseInfos> responseInfos = new ArrayList<>();
    for (AbstractTextEntryInteractionStatistics entry : processedAnswers) {
        String label = Integer.toString(++i);
        String answerString = entry.getCorrectResponse();
        d1.add(entry.getNumOfCorrect(), label, cssColor);
        StringBuilder text = new StringBuilder();
        text.append(answerString);
        if (entry instanceof TextEntryInteractionStatistics) {
            TextEntryInteractionStatistics textEntry = (TextEntryInteractionStatistics) entry;
            if (textEntry.getAlternatives().size() > 1) {
                text.append(" [");
                for (int j = 1; j < textEntry.getAlternatives().size(); j++) {
                    if (j > 1)
                        text.append(", ");
                    text.append(textEntry.getAlternatives().get(j));
                }
                text.append("]");
            }
        }
        Float score = entry.getPoints() == null ? null : entry.getPoints().floatValue();
        responseInfos.add(new ResponseInfos(label, text.toString(), entry.getWrongAnswers(), score, true, survey, false));
    }
    List<BarSeries> serieList = Collections.singletonList(d1);
    Series series = new Series(serieList, responseInfos, numOfParticipants, false);
    series.setChartType(SeriesFactory.BAR_ANSWERED);
    series.setItemCss("o_mi_qtifib");
    return series;
}
Also used : ArrayList(java.util.ArrayList) AbstractTextEntryInteractionStatistics(org.olat.ims.qti21.model.statistics.AbstractTextEntryInteractionStatistics) BarSeries(org.olat.core.gui.components.chart.BarSeries) AbstractTextEntryInteractionStatistics(org.olat.ims.qti21.model.statistics.AbstractTextEntryInteractionStatistics) TextEntryInteractionStatistics(org.olat.ims.qti21.model.statistics.TextEntryInteractionStatistics) Series(org.olat.ims.qti.statistics.ui.Series) BarSeries(org.olat.core.gui.components.chart.BarSeries) ResponseInfos(org.olat.ims.qti.statistics.ui.ResponseInfos)

Aggregations

ArrayList (java.util.ArrayList)12 BarSeries (org.olat.core.gui.components.chart.BarSeries)12 ResponseInfos (org.olat.ims.qti.statistics.ui.ResponseInfos)12 Series (org.olat.ims.qti.statistics.ui.Series)12 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)10 ChoiceStatistics (org.olat.ims.qti21.model.statistics.ChoiceStatistics)4 HotspotChoiceStatistics (org.olat.ims.qti21.model.statistics.HotspotChoiceStatistics)4 Choice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.Choice)4 HotspotChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.graphic.HotspotChoice)4 AbstractTextEntryInteractionStatistics (org.olat.ims.qti21.model.statistics.AbstractTextEntryInteractionStatistics)2 KPrimStatistics (org.olat.ims.qti21.model.statistics.KPrimStatistics)2 TextEntryInteractionStatistics (org.olat.ims.qti21.model.statistics.TextEntryInteractionStatistics)2 SimpleAssociableChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice)2 SimpleMatchSet (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleMatchSet)2