Search in sources :

Example 1 with QTIStatisticResult

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()));
}
Also used : QTIResultSet(org.olat.ims.qti.QTIResultSet) QTIResult(org.olat.ims.qti.QTIResult) QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) QTIStatisticResult(org.olat.ims.qti.statistics.model.QTIStatisticResult) Test(org.junit.Test)

Example 2 with QTIStatisticResult

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()));
}
Also used : QTIResultSet(org.olat.ims.qti.QTIResultSet) QTIResult(org.olat.ims.qti.QTIResult) QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) QTIStatisticResult(org.olat.ims.qti.statistics.model.QTIStatisticResult) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Identity (org.olat.core.id.Identity)2 QTIResult (org.olat.ims.qti.QTIResult)2 QTIResultSet (org.olat.ims.qti.QTIResultSet)2 QTIStatisticSearchParams (org.olat.ims.qti.statistics.QTIStatisticSearchParams)2 QTIStatisticResult (org.olat.ims.qti.statistics.model.QTIStatisticResult)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2