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;
}
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;
}
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;
}
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;
}
Aggregations