Search in sources :

Example 1 with StatisticKPrimOption

use of org.olat.ims.qti.statistics.model.StatisticKPrimOption in project OpenOLAT by OpenOLAT.

the class SeriesFactory method getKPrim.

public Series getKPrim(Item item) {
    List<StatisticKPrimOption> statisticResponses = qtiStatisticsManager.getNumbersInKPrim(item, resourceResult.getSearchParams());
    String mediaBaseURL = resourceResult.getMediaBaseURL();
    boolean survey = QTIType.survey.equals(resourceResult.getType());
    int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
    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 (StatisticKPrimOption statisticResponse : statisticResponses) {
        Response response = statisticResponse.getResponse();
        boolean correct = response.isCorrect();
        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 = response.getContent().renderAsHtml(mediaBaseURL);
        responseInfos.add(new ResponseInfos(label, text, null, correct, 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 ? BAR_ANSWERED : BAR_CORRECT_WRONG_NOT);
    series.setItemCss(getCssClass(item));
    return series;
}
Also used : ArrayList(java.util.ArrayList) BarSeries(org.olat.core.gui.components.chart.BarSeries) Response(org.olat.ims.qti.editor.beecom.objects.Response) BarSeries(org.olat.core.gui.components.chart.BarSeries) StatisticKPrimOption(org.olat.ims.qti.statistics.model.StatisticKPrimOption)

Example 2 with StatisticKPrimOption

use of org.olat.ims.qti.statistics.model.StatisticKPrimOption in project OpenOLAT by OpenOLAT.

the class QTIStatisticsManagerImpl method getNumbersInKPrim.

@Override
public List<StatisticKPrimOption> getNumbersInKPrim(Item item, QTIStatisticSearchParams searchParams) {
    List<StatisticAnswerOption> rawDatas = getStatisticAnswerOptionsOfItem(item.getIdent(), searchParams);
    List<Response> responses = item.getQuestion().getResponses();
    List<StatisticKPrimOption> kprimPoints = new ArrayList<>();
    for (Response response : responses) {
        String answerIdent = response.getIdent();
        boolean isCorrect = response.isCorrect();
        String rightFlag = answerIdent + ":" + (isCorrect ? "correct" : "wrong");
        String wrongFlag = answerIdent + ":" + (isCorrect ? "wrong" : "correct");
        long numCorrect = 0;
        long numIncorrect = 0;
        long numUnanswered = 0;
        for (StatisticAnswerOption rawData : rawDatas) {
            String answer = rawData.getAnswer();
            if (answer.indexOf(rightFlag) >= 0) {
                numCorrect += rawData.getCount();
            } else if (answer.indexOf(wrongFlag) >= 0) {
                numIncorrect += rawData.getCount();
            } else {
                numUnanswered += rawData.getCount();
            }
        }
        kprimPoints.add(new StatisticKPrimOption(response, numCorrect, numIncorrect, numUnanswered));
    }
    return kprimPoints;
}
Also used : StatisticSurveyItemResponse(org.olat.ims.qti.statistics.model.StatisticSurveyItemResponse) FIBResponse(org.olat.ims.qti.editor.beecom.objects.FIBResponse) Response(org.olat.ims.qti.editor.beecom.objects.Response) StatisticAnswerOption(org.olat.ims.qti.statistics.model.StatisticAnswerOption) StatisticKPrimOption(org.olat.ims.qti.statistics.model.StatisticKPrimOption) ArrayList(java.util.ArrayList)

Example 3 with StatisticKPrimOption

use of org.olat.ims.qti.statistics.model.StatisticKPrimOption in project openolat by klemens.

the class QTIStatisticsManagerImpl method getNumbersInKPrim.

@Override
public List<StatisticKPrimOption> getNumbersInKPrim(Item item, QTIStatisticSearchParams searchParams) {
    List<StatisticAnswerOption> rawDatas = getStatisticAnswerOptionsOfItem(item.getIdent(), searchParams);
    List<Response> responses = item.getQuestion().getResponses();
    List<StatisticKPrimOption> kprimPoints = new ArrayList<>();
    for (Response response : responses) {
        String answerIdent = response.getIdent();
        boolean isCorrect = response.isCorrect();
        String rightFlag = answerIdent + ":" + (isCorrect ? "correct" : "wrong");
        String wrongFlag = answerIdent + ":" + (isCorrect ? "wrong" : "correct");
        long numCorrect = 0;
        long numIncorrect = 0;
        long numUnanswered = 0;
        for (StatisticAnswerOption rawData : rawDatas) {
            String answer = rawData.getAnswer();
            if (answer.indexOf(rightFlag) >= 0) {
                numCorrect += rawData.getCount();
            } else if (answer.indexOf(wrongFlag) >= 0) {
                numIncorrect += rawData.getCount();
            } else {
                numUnanswered += rawData.getCount();
            }
        }
        kprimPoints.add(new StatisticKPrimOption(response, numCorrect, numIncorrect, numUnanswered));
    }
    return kprimPoints;
}
Also used : StatisticSurveyItemResponse(org.olat.ims.qti.statistics.model.StatisticSurveyItemResponse) FIBResponse(org.olat.ims.qti.editor.beecom.objects.FIBResponse) Response(org.olat.ims.qti.editor.beecom.objects.Response) StatisticAnswerOption(org.olat.ims.qti.statistics.model.StatisticAnswerOption) StatisticKPrimOption(org.olat.ims.qti.statistics.model.StatisticKPrimOption) ArrayList(java.util.ArrayList)

Example 4 with StatisticKPrimOption

use of org.olat.ims.qti.statistics.model.StatisticKPrimOption in project openolat by klemens.

the class SeriesFactory method getKPrim.

public Series getKPrim(Item item) {
    List<StatisticKPrimOption> statisticResponses = qtiStatisticsManager.getNumbersInKPrim(item, resourceResult.getSearchParams());
    String mediaBaseURL = resourceResult.getMediaBaseURL();
    boolean survey = QTIType.survey.equals(resourceResult.getType());
    int numOfParticipants = resourceResult.getQTIStatisticAssessment().getNumOfParticipants();
    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 (StatisticKPrimOption statisticResponse : statisticResponses) {
        Response response = statisticResponse.getResponse();
        boolean correct = response.isCorrect();
        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 = response.getContent().renderAsHtml(mediaBaseURL);
        responseInfos.add(new ResponseInfos(label, text, null, correct, 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 ? BAR_ANSWERED : BAR_CORRECT_WRONG_NOT);
    series.setItemCss(getCssClass(item));
    return series;
}
Also used : ArrayList(java.util.ArrayList) BarSeries(org.olat.core.gui.components.chart.BarSeries) Response(org.olat.ims.qti.editor.beecom.objects.Response) BarSeries(org.olat.core.gui.components.chart.BarSeries) StatisticKPrimOption(org.olat.ims.qti.statistics.model.StatisticKPrimOption)

Aggregations

ArrayList (java.util.ArrayList)4 Response (org.olat.ims.qti.editor.beecom.objects.Response)4 StatisticKPrimOption (org.olat.ims.qti.statistics.model.StatisticKPrimOption)4 BarSeries (org.olat.core.gui.components.chart.BarSeries)2 FIBResponse (org.olat.ims.qti.editor.beecom.objects.FIBResponse)2 StatisticAnswerOption (org.olat.ims.qti.statistics.model.StatisticAnswerOption)2 StatisticSurveyItemResponse (org.olat.ims.qti.statistics.model.StatisticSurveyItemResponse)2