Search in sources :

Example 1 with QTIStatisticSearchParams

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

Example 2 with QTIStatisticSearchParams

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);
}
Also used : QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) QTIItemObject(org.olat.ims.qti.export.helper.QTIItemObject) StatisticsItem(org.olat.ims.qti.statistics.model.StatisticsItem) Test(org.junit.Test)

Example 3 with QTIStatisticSearchParams

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);
}
Also used : QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) QTIItemObject(org.olat.ims.qti.export.helper.QTIItemObject) StatisticsItem(org.olat.ims.qti.statistics.model.StatisticsItem) Test(org.junit.Test)

Example 4 with QTIStatisticSearchParams

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);
}
Also used : QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) OLATResourceable(org.olat.core.id.OLATResourceable) QTI21StatisticSearchParams(org.olat.ims.qti21.model.QTI21StatisticSearchParams) QTI21StatisticResourceResult(org.olat.ims.qti21.ui.statistics.QTI21StatisticResourceResult) QTIStatisticResourceResult(org.olat.ims.qti.statistics.QTIStatisticResourceResult) QTI21StatisticsSecurityCallback(org.olat.ims.qti21.ui.statistics.QTI21StatisticsSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 5 with QTIStatisticSearchParams

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());
}
Also used : QTIStatisticSearchParams(org.olat.ims.qti.statistics.QTIStatisticSearchParams) StatisticAssessment(org.olat.ims.qti.statistics.model.StatisticAssessment) 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