use of org.olat.ims.qti.export.helper.QTIItemObject in project openolat by klemens.
the class QTIStatisticsManagerLargeTest method testItemStatistics_singleChoice_0.
@Test
public void testItemStatistics_singleChoice_0() {
QTIItemObject itemObject = itemObjects.get(0);
double maxValue = Double.parseDouble(itemObject.getItemMaxValue());
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(olatResource, olatResourceDetail);
StatisticsItem stats = qtim.getItemStatistics(itemObject.getItemIdent(), maxValue, searchParams);
Assert.assertEquals(scoreQ1, stats.getAverageScore(), 0.1);
}
use of org.olat.ims.qti.export.helper.QTIItemObject in project openolat by klemens.
the class QTIStatisticsManagerLargeTest method testItemStatistics_multipleChoice_1.
@Test
public void testItemStatistics_multipleChoice_1() {
QTIItemObject itemObject = itemObjects.get(1);
double maxValue = Double.parseDouble(itemObject.getItemMaxValue());
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(olatResource, olatResourceDetail);
StatisticsItem stats = qtim.getItemStatistics(itemObject.getItemIdent(), maxValue, searchParams);
double difficulty = rightAnswersQ2 / (double) numberOfParticipants;
Assert.assertEquals(difficulty, stats.getDifficulty(), 0.1);
Assert.assertEquals(scoreQ2, stats.getAverageScore(), 0.1);
Assert.assertEquals(wrongAnswersQ2, stats.getNumOfIncorrectAnswers());
Assert.assertEquals(numberOfParticipants - wrongAnswersQ2, stats.getNumOfCorrectAnswers());
}
use of org.olat.ims.qti.export.helper.QTIItemObject in project openolat by klemens.
the class QTIStatisticsManagerLargeTest method testItemStatistics_kprim_2.
@Test
public void testItemStatistics_kprim_2() {
QTIItemObject itemObject = itemObjects.get(2);
double maxValue = Double.parseDouble(itemObject.getItemMaxValue());
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(olatResource, olatResourceDetail);
StatisticsItem stats = qtim.getItemStatistics(itemObject.getItemIdent(), maxValue, searchParams);
float durationQ3InSec = durationQ3;
Assert.assertEquals(durationQ3InSec, stats.getAverageDuration(), 1.0f);
}
use of org.olat.ims.qti.export.helper.QTIItemObject in project openolat by klemens.
the class IQEditReplaceWizard method doStep2.
private void doStep2(UserRequest ureq) {
String nodeTitle = courseNode.getShortTitle();
if (results != null && !results.isEmpty()) {
exportDir = CourseFactory.getOrCreateDataExportDirectory(ureq.getIdentity(), course.getCourseTitle());
UserManager um = UserManager.getInstance();
String charset = um.getUserCharset(ureq.getIdentity());
QTIExportManager qem = QTIExportManager.getInstance();
Long repositoryRef = results.get(0).getResultSet().getRepositoryRef();
List<QTIItemObject> qtiItemObjectList = new QTIObjectTreeBuilder().getQTIItemObjectList(repositoryRef);
QTIExportFormatter formatter;
if (courseNode instanceof IQTESTCourseNode) {
formatter = new QTIExportFormatterCSVType1(ureq.getLocale(), "\t", "\"", "\r\n", false);
} else if (courseNode instanceof IQSELFCourseNode) {
formatter = new QTIExportFormatterCSVType1(ureq.getLocale(), "\t", "\"", "\r\n", false);
((QTIExportFormatterCSVType1) formatter).setAnonymous(true);
} else {
formatter = new QTIExportFormatterCSVType3(ureq.getLocale(), null, "\t", "\"", "\r\n", false);
}
Map<Class<?>, QTIExportItemFormatConfig> qtiItemConfigs = getQTIItemConfigs(qtiItemObjectList);
formatter.setMapWithExportItemConfigs(qtiItemConfigs);
resultExportFile = qem.exportResults(formatter, results, qtiItemObjectList, courseNode.getShortTitle(), exportDir, charset, ".xls");
vcStep2 = createVelocityContainer("replacewizard_step2");
String[] args1 = new String[] { Integer.toString(learners.size()) };
vcStep2.contextPut("information", translate("replace.wizard.information.paragraph1", args1));
String[] args2 = new String[] { exportDir.getName(), resultExportFile };
vcStep2.contextPut("information_par2", translate("replace.wizard.information.paragraph2", args2));
vcStep2.contextPut("nodetitle", nodeTitle);
showFileButton = LinkFactory.createButton("replace.wizard.showfile", vcStep2, this);
} else {
// it exists no result
String[] args = new String[] { Integer.toString(numberOfQtiSerEntries) };
vcStep2 = createVelocityContainer("replacewizard_step2");
vcStep2.contextPut("information", translate("replace.wizard.information.empty.results", args));
vcStep2.contextPut("nodetitle", nodeTitle);
}
nextBtn = LinkFactory.createButton("replace.wizard.next", vcStep2, this);
setNextWizardStep(translate("replace.wizard.title.step2"), vcStep2);
}
use of org.olat.ims.qti.export.helper.QTIItemObject in project openolat by klemens.
the class QTIExportManager method selectAndExportResults.
/**
* @param locale
* @param olatResource
* @param shortTitle
* @param olatResourceDetail
* @param repositoryRef
* @param type
* @param exportDirectory
* @param anonymizerCallback callback that should be used to anonymize the user names or NULL if row counter
* should be used (only for type 2 and 3)
* @return
*/
public boolean selectAndExportResults(QTIExportFormatter qef, Long courseResId, String shortTitle, String olatResourceDetail, Long testReKey, File exportDirectory, String charset, String fileNameSuffix) {
boolean resultsFoundAndExported = false;
QTIResultManager qrm = QTIResultManager.getInstance();
List<QTIResult> results = qrm.selectResults(courseResId, olatResourceDetail, testReKey, null, qef.getType());
if (results.size() > 0) {
QTIResult res0 = results.get(0);
List<QTIItemObject> qtiItemObjectList = new QTIObjectTreeBuilder().getQTIItemObjectList(new Long(res0.getResultSet().getRepositoryRef()));
qef.setQTIItemObjectList(qtiItemObjectList);
if (results.size() > 0) {
createContentOfExportFile(results, qtiItemObjectList, qef);
writeContentToFile(shortTitle, exportDirectory, charset, qef, fileNameSuffix);
resultsFoundAndExported = true;
}
}
return resultsFoundAndExported;
}
Aggregations