use of org.olat.ims.qti21.model.statistics.NumericalInputInteractionStatistics in project OpenOLAT by OpenOLAT.
the class QTI21StatisticsManagerImpl method getNumericalInputInteractionSettings.
private NumericalInputInteractionStatistics getNumericalInputInteractionSettings(Identifier responseIdentifier, ResponseDeclaration responseDeclaration, AssessmentItem item) {
NumericalEntry numericalEntry = new NumericalEntry(responseIdentifier);
FIBAssessmentItemBuilder.extractNumericalEntrySettings(item, numericalEntry, responseDeclaration, new AtomicInteger(), new DoubleAdder());
String correctResponse = "";
Double solution = numericalEntry.getSolution();
if (numericalEntry.getSolution() != null) {
correctResponse = solution.toString();
}
double points = Double.NaN;
if (numericalEntry.getScore() == null) {
// all score
points = 0.0d;
} else {
points = numericalEntry.getScore().doubleValue();
}
return new NumericalInputInteractionStatistics(responseIdentifier, correctResponse, solution, numericalEntry.getToleranceMode(), numericalEntry.getLowerTolerance(), numericalEntry.getUpperTolerance(), points);
}
use of org.olat.ims.qti21.model.statistics.NumericalInputInteractionStatistics in project openolat by klemens.
the class QTI21StatisticsManagerImpl method getTextEntryInteractionsStatistic.
@Override
public List<AbstractTextEntryInteractionStatistics> getTextEntryInteractionsStatistic(String itemRefIdent, AssessmentItem item, List<TextEntryInteraction> interactions, QTI21StatisticSearchParams searchParams) {
List<AbstractTextEntryInteractionStatistics> options = new ArrayList<>();
Map<String, AbstractTextEntryInteractionStatistics> optionMap = new HashMap<>();
for (TextEntryInteraction interaction : interactions) {
Identifier responseIdentifier = interaction.getResponseIdentifier();
ResponseDeclaration responseDeclaration = item.getResponseDeclaration(responseIdentifier);
if (responseDeclaration.hasBaseType(BaseType.STRING)) {
TextEntryInteractionStatistics stats = getTextEntryInteractionSettings(responseIdentifier, responseDeclaration);
optionMap.put(responseIdentifier.toString(), stats);
options.add(stats);
} else if (responseDeclaration.hasBaseType(BaseType.FLOAT)) {
NumericalInputInteractionStatistics stats = getNumericalInputInteractionSettings(responseIdentifier, responseDeclaration, item);
optionMap.put(responseIdentifier.toString(), stats);
options.add(stats);
}
}
for (TextEntryInteraction interaction : interactions) {
String responseIdentifier = interaction.getResponseIdentifier().toString();
List<RawData> datas = getRawDatas(itemRefIdent, responseIdentifier, searchParams);
for (RawData data : datas) {
Long count = data.getCount();
if (count != null && count.longValue() > 0) {
AbstractTextEntryInteractionStatistics stats = optionMap.get(responseIdentifier);
String response = data.getStringuifiedResponse();
if (response != null && response.length() >= 2 && response.startsWith("[") && response.endsWith("]")) {
response = response.substring(1, response.length() - 1);
}
if (stats.matchResponse(response)) {
stats.addCorrect(count.longValue());
} else {
stats.addIncorrect(count.longValue());
stats.addWrongResponses(response);
}
}
}
}
return options;
}
use of org.olat.ims.qti21.model.statistics.NumericalInputInteractionStatistics in project OpenOLAT by OpenOLAT.
the class QTI21StatisticsManagerImpl method getTextEntryInteractionsStatistic.
@Override
public List<AbstractTextEntryInteractionStatistics> getTextEntryInteractionsStatistic(String itemRefIdent, AssessmentItem item, List<TextEntryInteraction> interactions, QTI21StatisticSearchParams searchParams) {
List<AbstractTextEntryInteractionStatistics> options = new ArrayList<>();
Map<String, AbstractTextEntryInteractionStatistics> optionMap = new HashMap<>();
for (TextEntryInteraction interaction : interactions) {
Identifier responseIdentifier = interaction.getResponseIdentifier();
ResponseDeclaration responseDeclaration = item.getResponseDeclaration(responseIdentifier);
if (responseDeclaration.hasBaseType(BaseType.STRING)) {
TextEntryInteractionStatistics stats = getTextEntryInteractionSettings(responseIdentifier, responseDeclaration);
optionMap.put(responseIdentifier.toString(), stats);
options.add(stats);
} else if (responseDeclaration.hasBaseType(BaseType.FLOAT)) {
NumericalInputInteractionStatistics stats = getNumericalInputInteractionSettings(responseIdentifier, responseDeclaration, item);
optionMap.put(responseIdentifier.toString(), stats);
options.add(stats);
}
}
for (TextEntryInteraction interaction : interactions) {
String responseIdentifier = interaction.getResponseIdentifier().toString();
List<RawData> datas = getRawDatas(itemRefIdent, responseIdentifier, searchParams);
for (RawData data : datas) {
Long count = data.getCount();
if (count != null && count.longValue() > 0) {
AbstractTextEntryInteractionStatistics stats = optionMap.get(responseIdentifier);
String response = data.getStringuifiedResponse();
if (response != null && response.length() >= 2 && response.startsWith("[") && response.endsWith("]")) {
response = response.substring(1, response.length() - 1);
}
if (stats.matchResponse(response)) {
stats.addCorrect(count.longValue());
} else {
stats.addIncorrect(count.longValue());
stats.addWrongResponses(response);
}
}
}
}
return options;
}
use of org.olat.ims.qti21.model.statistics.NumericalInputInteractionStatistics in project openolat by klemens.
the class QTI21StatisticsManagerImpl method getNumericalInputInteractionSettings.
private NumericalInputInteractionStatistics getNumericalInputInteractionSettings(Identifier responseIdentifier, ResponseDeclaration responseDeclaration, AssessmentItem item) {
NumericalEntry numericalEntry = new NumericalEntry(responseIdentifier);
FIBAssessmentItemBuilder.extractNumericalEntrySettings(item, numericalEntry, responseDeclaration, new AtomicInteger(), new DoubleAdder());
String correctResponse = "";
Double solution = numericalEntry.getSolution();
if (numericalEntry.getSolution() != null) {
correctResponse = solution.toString();
}
double points = Double.NaN;
if (numericalEntry.getScore() == null) {
// all score
points = 0.0d;
} else {
points = numericalEntry.getScore().doubleValue();
}
return new NumericalInputInteractionStatistics(responseIdentifier, correctResponse, solution, numericalEntry.getToleranceMode(), numericalEntry.getLowerTolerance(), numericalEntry.getUpperTolerance(), points);
}
Aggregations