use of org.olat.ims.qti21.model.statistics.TextEntryInteractionStatistics 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;
}
Aggregations