Search in sources :

Example 6 with QTIStatisticSearchParams

use of org.olat.ims.qti.statistics.QTIStatisticSearchParams in project openolat by klemens.

the class QTIStatisticsManagerLargeTest method testAnswerTexts.

@Test
public void testAnswerTexts() {
    QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(olatResource, olatResourceDetail);
    List<String> answers = qtim.getAnswers("QTIEDIT:FIB:1000010792", searchParams);
    Assert.assertTrue(answers.containsAll(fibAnswers));
    Assert.assertTrue(fibAnswers.containsAll(answers));
}
Also used : QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) Test(org.junit.Test)

Example 7 with QTIStatisticSearchParams

use of org.olat.ims.qti.statistics.QTIStatisticSearchParams in project openolat by klemens.

the class QTIStatisticsManagerTest method testResultSetStatistics.

@Test
public void testResultSetStatistics() {
    RepositoryEntry re = createRepository();
    long assessmentId = 837l;
    String resSubPath = "1237";
    for (int i = 0; i < 10; i++) {
        Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-1" + i);
        float score = Math.round((Math.random() * 10) + 1l);
        createSet(score, assessmentId, id, re, resSubPath, modDate(3, 8, 8), modDate(3, 8, 12));
    }
    dbInstance.commit();
    QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(re.getOlatResource().getResourceableId(), resSubPath);
    StatisticAssessment stats = qtiStatisticsManager.getAssessmentStatistics(searchParams);
    Assert.assertNotNull(stats);
}
Also used : QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) StatisticAssessment(org.olat.ims.qti.statistics.model.StatisticAssessment) Test(org.junit.Test)

Example 8 with QTIStatisticSearchParams

use of org.olat.ims.qti.statistics.QTIStatisticSearchParams 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 9 with QTIStatisticSearchParams

use of org.olat.ims.qti.statistics.QTIStatisticSearchParams in project OpenOLAT by OpenOLAT.

the class QTIStatisticsManagerTest method testResultSetStatistics.

@Test
public void testResultSetStatistics() {
    RepositoryEntry re = createRepository();
    long assessmentId = 837l;
    String resSubPath = "1237";
    for (int i = 0; i < 10; i++) {
        Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("qti-stats-1" + i);
        float score = Math.round((Math.random() * 10) + 1l);
        createSet(score, assessmentId, id, re, resSubPath, modDate(3, 8, 8), modDate(3, 8, 12));
    }
    dbInstance.commit();
    QTIStatisticSearchParams searchParams = new QTIStatisticSearchParams(re.getOlatResource().getResourceableId(), resSubPath);
    StatisticAssessment stats = qtiStatisticsManager.getAssessmentStatistics(searchParams);
    Assert.assertNotNull(stats);
}
Also used : QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) StatisticAssessment(org.olat.ims.qti.statistics.model.StatisticAssessment) Test(org.junit.Test)

Example 10 with QTIStatisticSearchParams

use of org.olat.ims.qti.statistics.QTIStatisticSearchParams 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

QTIStatisticSearchParams (org.olat.ims.qti.statistics.QTIStatisticSearchParams)20 Test (org.junit.Test)16 RepositoryEntry (org.olat.repository.RepositoryEntry)10 Identity (org.olat.core.id.Identity)6 QTIItemObject (org.olat.ims.qti.export.helper.QTIItemObject)6 StatisticsItem (org.olat.ims.qti.statistics.model.StatisticsItem)6 OLATResourceable (org.olat.core.id.OLATResourceable)4 QTIResultSet (org.olat.ims.qti.QTIResultSet)4 QTIStatisticResourceResult (org.olat.ims.qti.statistics.QTIStatisticResourceResult)4 StatisticAssessment (org.olat.ims.qti.statistics.model.StatisticAssessment)4 QTI21StatisticSearchParams (org.olat.ims.qti21.model.QTI21StatisticSearchParams)4 QTI21StatisticResourceResult (org.olat.ims.qti21.ui.statistics.QTI21StatisticResourceResult)4 QTI21StatisticsSecurityCallback (org.olat.ims.qti21.ui.statistics.QTI21StatisticsSecurityCallback)4 QTIResult (org.olat.ims.qti.QTIResult)2 QTIStatisticResult (org.olat.ims.qti.statistics.model.QTIStatisticResult)2 QTIStatisticResultSet (org.olat.ims.qti.statistics.model.QTIStatisticResultSet)2 QTI21DeliveryOptions (org.olat.ims.qti21.QTI21DeliveryOptions)2 QTI21Service (org.olat.ims.qti21.QTI21Service)2