use of org.olat.ims.qti.statistics.QTIStatisticSearchParams in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
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.statistics.QTIStatisticSearchParams in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
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);
}
use of org.olat.ims.qti.statistics.QTIStatisticSearchParams in project openolat by klemens.
the class QTIStatisticsManagerLargeTest method testStatistics.
@Test
public void testStatistics() {
long start = System.currentTimeMillis();
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(olatResource, olatResourceDetail);
StatisticAssessment stats = qtim.getAssessmentStatistics(searchParams);
log.info("Statistics of resource takes (ms): " + (System.currentTimeMillis() - start));
Assert.assertNotNull(stats);
Assert.assertEquals(averageScore, stats.getAverage(), 0.01);
Assert.assertEquals(numberOfParticipants, stats.getNumOfParticipants());
Assert.assertEquals(numberOfTestFailed, stats.getNumOfFailed());
Assert.assertEquals(numberOfTestPassed, stats.getNumOfPassed());
double maxScore = scorePerParticipant.get(scorePerParticipant.size() - 1).doubleValue();
double minScore = scorePerParticipant.get(0).doubleValue();
double range = maxScore - minScore;
Assert.assertEquals(maxScore, stats.getMaxScore(), 0.1);
Assert.assertEquals(minScore, stats.getMinScore(), 0.1);
Assert.assertEquals(range, stats.getRange(), 0.1);
Assert.assertEquals(averageDuration, stats.getAverageDuration(), 2);
Assert.assertTrue(stats.getStandardDeviation() > 0);
Assert.assertTrue(stats.getMedian() > 0);
Assert.assertNotNull(stats.getDurations());
Assert.assertNotNull(stats.getScores());
Assert.assertNotNull(stats.getMode());
Assert.assertFalse(stats.getMode().isEmpty());
}
Aggregations