use of org.olat.ims.qti.statistics.model.QTIStatisticResult in project openolat by klemens.
the class QTIStatisticsManagerTest method testResultStatistics.
/**
* retrieve the results of the last modified result set
*/
@Test
public void testResultStatistics() {
RepositoryEntry re = createRepository();
long assessmentId = 838l;
String resSubPath = "1238";
String firstQuestion = "id:123";
String secondQuestion = "id:124";
String thirdQuestion = "id:125";
Identity id1 = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-20");
Identity id2 = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-21");
// 3 try for id1
QTIResultSet set1_1 = createSet(2.0f, assessmentId, id1, re, resSubPath, modDate(3, 8, 8), modDate(3, 8, 12));
QTIResult result1_1_1 = createResult(firstQuestion, "test 1", set1_1);
QTIResult result1_1_2 = createResult(secondQuestion, "test 2", set1_1);
QTIResult result1_1_3 = createResult(thirdQuestion, "test 3", set1_1);
QTIResultSet set1_3 = createSet(6.0f, assessmentId, id1, re, resSubPath, modDate(3, 14, 7), modDate(3, 14, 38));
QTIResult result1_3_1 = createResult(firstQuestion, "test 1", set1_3);
QTIResult result1_3_2 = createResult(secondQuestion, "test 2", set1_3);
QTIResult result1_3_3 = createResult(thirdQuestion, "test 3", set1_3);
QTIResultSet set1_2 = createSet(4.0f, assessmentId, id1, re, resSubPath, modDate(3, 10, 34), modDate(3, 10, 45));
QTIResult result1_2_1 = createResult(firstQuestion, "test 1", set1_2);
QTIResult result1_2_2 = createResult(secondQuestion, "test 2", set1_2);
QTIResult result1_2_3 = createResult(thirdQuestion, "test 3", set1_2);
// 1 try for id2
QTIResultSet set2_1 = createSet(6.0f, assessmentId, id2, re, resSubPath, modDate(3, 9, 21), modDate(3, 9, 45));
QTIResult result2_1_1 = createResult(firstQuestion, "test 1", set2_1);
QTIResult result2_1_2 = createResult(secondQuestion, "test 2", set2_1);
QTIResult result2_1_3 = createResult(thirdQuestion, "test 3", set2_1);
dbInstance.commit();
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(re.getOlatResource().getResourceableId(), resSubPath);
List<QTIStatisticResult> results = qtiStatisticsManager.getResults(searchParams);
Assert.assertNotNull(results);
Assert.assertEquals(6, results.size());
List<Long> setKeys = PersistenceHelper.toKeys(results);
Assert.assertTrue(setKeys.contains(result1_3_1.getKey()));
Assert.assertTrue(setKeys.contains(result1_3_2.getKey()));
Assert.assertTrue(setKeys.contains(result1_3_3.getKey()));
Assert.assertTrue(setKeys.contains(result2_1_1.getKey()));
Assert.assertTrue(setKeys.contains(result2_1_2.getKey()));
Assert.assertTrue(setKeys.contains(result2_1_3.getKey()));
Assert.assertFalse(setKeys.contains(result1_1_1.getKey()));
Assert.assertFalse(setKeys.contains(result1_1_2.getKey()));
Assert.assertFalse(setKeys.contains(result1_1_3.getKey()));
Assert.assertFalse(setKeys.contains(result1_2_1.getKey()));
Assert.assertFalse(setKeys.contains(result1_2_2.getKey()));
Assert.assertFalse(setKeys.contains(result1_2_3.getKey()));
}
use of org.olat.ims.qti.statistics.model.QTIStatisticResult in project OpenOLAT by OpenOLAT.
the class QTIStatisticsManagerTest method testResultStatistics.
/**
* retrieve the results of the last modified result set
*/
@Test
public void testResultStatistics() {
RepositoryEntry re = createRepository();
long assessmentId = 838l;
String resSubPath = "1238";
String firstQuestion = "id:123";
String secondQuestion = "id:124";
String thirdQuestion = "id:125";
Identity id1 = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-20");
Identity id2 = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-21");
// 3 try for id1
QTIResultSet set1_1 = createSet(2.0f, assessmentId, id1, re, resSubPath, modDate(3, 8, 8), modDate(3, 8, 12));
QTIResult result1_1_1 = createResult(firstQuestion, "test 1", set1_1);
QTIResult result1_1_2 = createResult(secondQuestion, "test 2", set1_1);
QTIResult result1_1_3 = createResult(thirdQuestion, "test 3", set1_1);
QTIResultSet set1_3 = createSet(6.0f, assessmentId, id1, re, resSubPath, modDate(3, 14, 7), modDate(3, 14, 38));
QTIResult result1_3_1 = createResult(firstQuestion, "test 1", set1_3);
QTIResult result1_3_2 = createResult(secondQuestion, "test 2", set1_3);
QTIResult result1_3_3 = createResult(thirdQuestion, "test 3", set1_3);
QTIResultSet set1_2 = createSet(4.0f, assessmentId, id1, re, resSubPath, modDate(3, 10, 34), modDate(3, 10, 45));
QTIResult result1_2_1 = createResult(firstQuestion, "test 1", set1_2);
QTIResult result1_2_2 = createResult(secondQuestion, "test 2", set1_2);
QTIResult result1_2_3 = createResult(thirdQuestion, "test 3", set1_2);
// 1 try for id2
QTIResultSet set2_1 = createSet(6.0f, assessmentId, id2, re, resSubPath, modDate(3, 9, 21), modDate(3, 9, 45));
QTIResult result2_1_1 = createResult(firstQuestion, "test 1", set2_1);
QTIResult result2_1_2 = createResult(secondQuestion, "test 2", set2_1);
QTIResult result2_1_3 = createResult(thirdQuestion, "test 3", set2_1);
dbInstance.commit();
QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(re.getOlatResource().getResourceableId(), resSubPath);
List<QTIStatisticResult> results = qtiStatisticsManager.getResults(searchParams);
Assert.assertNotNull(results);
Assert.assertEquals(6, results.size());
List<Long> setKeys = PersistenceHelper.toKeys(results);
Assert.assertTrue(setKeys.contains(result1_3_1.getKey()));
Assert.assertTrue(setKeys.contains(result1_3_2.getKey()));
Assert.assertTrue(setKeys.contains(result1_3_3.getKey()));
Assert.assertTrue(setKeys.contains(result2_1_1.getKey()));
Assert.assertTrue(setKeys.contains(result2_1_2.getKey()));
Assert.assertTrue(setKeys.contains(result2_1_3.getKey()));
Assert.assertFalse(setKeys.contains(result1_1_1.getKey()));
Assert.assertFalse(setKeys.contains(result1_1_2.getKey()));
Assert.assertFalse(setKeys.contains(result1_1_3.getKey()));
Assert.assertFalse(setKeys.contains(result1_2_1.getKey()));
Assert.assertFalse(setKeys.contains(result1_2_2.getKey()));
Assert.assertFalse(setKeys.contains(result1_2_3.getKey()));
}
Aggregations