use of org.olat.ims.qti.statistics.QTIStatisticSearchParams 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.statistics.QTIStatisticSearchParams 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.statistics.QTIStatisticSearchParams in project openolat by klemens.
the class QTIStatisticsManagerTest method testLastQTIResultsSetQuery.
/**
* Test retrieve the last modified result set for every assessed users
*/
@Test
public void testLastQTIResultsSetQuery() {
RepositoryEntry re = createRepository();
Identity id1 = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-1");
Identity id2 = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-2");
Identity id3 = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-3");
dbInstance.commit();
long assessmentId = 835l;
String resSubPath = "1234";
// 3 try for id1
QTIResultSet set1_1 = createSet(2.0f, assessmentId, id1, re, resSubPath, modDate(3, 8, 8), modDate(3, 8, 12));
QTIResultSet set1_3 = createSet(6.0f, assessmentId, id1, re, resSubPath, modDate(3, 14, 7), modDate(3, 14, 38));
QTIResultSet set1_2 = createSet(4.0f, assessmentId, id1, re, resSubPath, modDate(3, 10, 34), modDate(3, 10, 45));
// 2 try for id2
QTIResultSet set2_1 = createSet(6.0f, assessmentId, id2, re, resSubPath, modDate(3, 9, 21), modDate(3, 9, 45));
QTIResultSet set2_2 = createSet(5.0f, assessmentId, id2, re, resSubPath, modDate(3, 12, 45), modDate(3, 12, 55));
// 1 try for id1
QTIResultSet set3_1 = createSet(1.0f, assessmentId, id3, re, resSubPath, modDate(3, 12, 1), modDate(3, 12, 12));
dbInstance.commit();
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(re.getOlatResource().getResourceableId(), resSubPath);
List<QTIStatisticResultSet> sets = qtiStatisticsManager.getAllResultSets(searchParams);
Assert.assertNotNull(sets);
Assert.assertEquals(3, sets.size());
List<Long> setKeys = PersistenceHelper.toKeys(sets);
Assert.assertTrue(setKeys.contains(set1_3.getKey()));
Assert.assertTrue(setKeys.contains(set2_2.getKey()));
Assert.assertTrue(setKeys.contains(set3_1.getKey()));
Assert.assertFalse(setKeys.contains(set1_1.getKey()));
Assert.assertFalse(setKeys.contains(set1_2.getKey()));
Assert.assertFalse(setKeys.contains(set2_1.getKey()));
}
use of org.olat.ims.qti.statistics.QTIStatisticSearchParams 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);
}
use of org.olat.ims.qti.statistics.QTIStatisticSearchParams in project openolat by klemens.
the class IQTESTCourseNode 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 qtiTestEntry = getReferencedRepositoryEntry();
if (ImsQTI21Resource.TYPE_NAME.equals(qtiTestEntry.getOlatResource().getResourceableTypeName())) {
RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
QTI21StatisticSearchParams searchParams = new QTI21StatisticSearchParams(qtiTestEntry, courseEntry, getIdent());
boolean admin = userCourseEnv.isAdmin();
if (options.getParticipantsGroups() != null) {
searchParams.setLimitToGroups(options.getParticipantsGroups());
}
QTI21StatisticsSecurityCallback secCallback = new QTI21StatisticsSecurityCallback(admin, admin && isGuestAllowedForQTI21(qtiTestEntry));
return new QTI21StatisticResourceResult(qtiTestEntry, courseEntry, this, searchParams, secCallback);
}
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(courseOres.getResourceableId(), getIdent());
searchParams.setLimitToGroups(options.getParticipantsGroups());
return new QTIStatisticResourceResult(courseOres, this, qtiTestEntry, searchParams);
}
Aggregations