use of org.olat.ims.qti21.model.QTI21StatisticSearchParams 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.QTI21StatisticSearchParams in project OpenOLAT by OpenOLAT.
the class QTI21ResultsExportMediaResource method exportExcelResults.
private void exportExcelResults(RepositoryEntry testEntry, ZipOutputStream zout) {
ArchiveOptions options = new ArchiveOptions();
options.setIdentities(identities);
QTI21StatisticSearchParams searchParams = new QTI21StatisticSearchParams(options, testEntry, entry, courseNode.getIdent());
searchParams.setLimitToIdentities(identities);
QTI21ArchiveFormat qaf = new QTI21ArchiveFormat(translator.getLocale(), searchParams);
String label = StringHelper.transformDisplayNameToFileSystemName(courseNode.getShortName() + "_" + testEntry.getDisplayname()) + "_" + Formatter.formatDatetimeWithMinutes(new Date()) + ".xlsx";
qaf.exportCourseElement(exportFolderName + "/" + label, zout);
}
use of org.olat.ims.qti21.model.QTI21StatisticSearchParams in project OpenOLAT by OpenOLAT.
the class QTI21ResetDataController method archiveData.
private void archiveData(RepositoryEntry testEntry) {
// backup
String archiveName = "qti21test_" + StringHelper.transformDisplayNameToFileSystemName(testEntry.getDisplayname()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())) + ".zip";
Path exportPath = Paths.get(FolderConfig.getCanonicalRoot(), FolderConfig.getUserHomes(), getIdentity().getName(), "private", "archive", StringHelper.transformDisplayNameToFileSystemName(testEntry.getDisplayname()), archiveName);
File exportFile = exportPath.toFile();
exportFile.getParentFile().mkdirs();
try (FileOutputStream fileStream = new FileOutputStream(exportFile);
ZipOutputStream exportStream = new ZipOutputStream(fileStream)) {
// author can do this, also they can archive all users and anonyme users
QTI21StatisticSearchParams searchParams = new QTI21StatisticSearchParams(testEntry, null, null, true, true);
new QTI21ArchiveFormat(getLocale(), searchParams).exportResource(exportStream);
} catch (IOException e) {
logError("", e);
}
}
use of org.olat.ims.qti21.model.QTI21StatisticSearchParams in project OpenOLAT by OpenOLAT.
the class IQSURVCourseNode method createStatisticNodeResult.
@Override
public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, StatisticResourceOption options, QTIType... types) {
if (!isQTITypeAllowed(types))
return null;
Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
OLATResourceable courseOres = OresHelper.createOLATResourceableInstance("CourseModule", courseId);
RepositoryEntry qtiSurveyEntry = getReferencedRepositoryEntry();
if (ImsQTI21Resource.TYPE_NAME.equals(qtiSurveyEntry.getOlatResource().getResourceableTypeName())) {
RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
QTI21StatisticSearchParams searchParams = new QTI21StatisticSearchParams(qtiSurveyEntry, courseEntry, getIdent());
searchParams.setLimitToGroups(options.getParticipantsGroups());
QTI21DeliveryOptions deliveryOptions = CoreSpringFactory.getImpl(QTI21Service.class).getDeliveryOptions(qtiSurveyEntry);
boolean admin = userCourseEnv.isAdmin();
QTI21StatisticsSecurityCallback secCallback = new QTI21StatisticsSecurityCallback(admin, admin && deliveryOptions.isAllowAnonym());
return new QTI21StatisticResourceResult(qtiSurveyEntry, courseEntry, this, searchParams, secCallback);
}
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(courseOres.getResourceableId(), getIdent());
searchParams.setLimitToGroups(options.getParticipantsGroups());
return new QTIStatisticResourceResult(courseOres, this, qtiSurveyEntry, searchParams);
}
use of org.olat.ims.qti21.model.QTI21StatisticSearchParams in project openolat by klemens.
the class IQSURVCourseNode method createStatisticNodeResult.
@Override
public StatisticResourceResult createStatisticNodeResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, StatisticResourceOption options, QTIType... types) {
if (!isQTITypeAllowed(types))
return null;
Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
OLATResourceable courseOres = OresHelper.createOLATResourceableInstance("CourseModule", courseId);
RepositoryEntry qtiSurveyEntry = getReferencedRepositoryEntry();
if (ImsQTI21Resource.TYPE_NAME.equals(qtiSurveyEntry.getOlatResource().getResourceableTypeName())) {
RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
QTI21StatisticSearchParams searchParams = new QTI21StatisticSearchParams(qtiSurveyEntry, courseEntry, getIdent());
searchParams.setLimitToGroups(options.getParticipantsGroups());
QTI21DeliveryOptions deliveryOptions = CoreSpringFactory.getImpl(QTI21Service.class).getDeliveryOptions(qtiSurveyEntry);
boolean admin = userCourseEnv.isAdmin();
QTI21StatisticsSecurityCallback secCallback = new QTI21StatisticsSecurityCallback(admin, admin && deliveryOptions.isAllowAnonym());
return new QTI21StatisticResourceResult(qtiSurveyEntry, courseEntry, this, searchParams, secCallback);
}
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(courseOres.getResourceableId(), getIdent());
searchParams.setLimitToGroups(options.getParticipantsGroups());
return new QTIStatisticResourceResult(courseOres, this, qtiSurveyEntry, searchParams);
}
Aggregations