Search in sources :

Example 11 with QTIResultSet

use of org.olat.ims.qti.QTIResultSet 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)

Example 12 with QTIResultSet

use of org.olat.ims.qti.QTIResultSet in project OpenOLAT by OpenOLAT.

the class OLATUpgrade_12_0_0 method updateTest.

private void updateTest(RepositoryEntry entry, IQTESTCourseNode courseNode, Set<Identity> changeSet) {
    boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(courseNode.getModuleConfiguration().get(IQEditController.CONFIG_KEY_TYPE_QTI));
    if (onyx)
        return;
    RepositoryEntry testEntry = courseNode.getReferencedRepositoryEntry();
    OLATResource ores = testEntry.getOlatResource();
    boolean qti21 = ImsQTI21Resource.TYPE_NAME.equals(ores.getResourceableTypeName());
    List<AssessmentEntryImpl> assessmentEntries = loadAssessmentEntries(entry, courseNode.getIdent());
    for (AssessmentEntryImpl assessmentEntry : assessmentEntries) {
        if (assessmentEntry.getLastUserModified() != null || assessmentEntry.getLastCoachModified() != null)
            continue;
        if (qti21) {
            Long assessmentId = assessmentEntry.getAssessmentId();
            if (assessmentId != null) {
                AssessmentTestSession session = qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
                if (session != null && session.getFinishTime() != null) {
                    assessmentEntry.setLastUserModified(session.getFinishTime());
                    updateAssessmentEntry(assessmentEntry);
                    changeSet.add(assessmentEntry.getIdentity());
                }
            }
        } else {
            long olatResource = entry.getOlatResource().getResourceableId().longValue();
            QTIResultSet rset = iqManager.getLastResultSet(assessmentEntry.getIdentity(), olatResource, courseNode.getIdent());
            if (rset != null && rset.getLastModified() != null) {
                assessmentEntry.setLastUserModified(rset.getLastModified());
                updateAssessmentEntry(assessmentEntry);
                changeSet.add(assessmentEntry.getIdentity());
            }
        }
    }
}
Also used : QTIResultSet(org.olat.ims.qti.QTIResultSet) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessmentEntryImpl(org.olat.modules.assessment.model.AssessmentEntryImpl)

Example 13 with QTIResultSet

use of org.olat.ims.qti.QTIResultSet in project OpenOLAT by OpenOLAT.

the class OLATUpgrade_11_0_0 method processAssessmentPropertyForIQTEST.

/**
 * If a QTI ser is found, the test is in progress. If not, check if some result set is available
 * and if the test has essay to set the status as inReview or done.
 *
 * @param assessedIdentity
 * @param entry
 * @param cNode
 * @param course
 */
private void processAssessmentPropertyForIQTEST(Identity assessedIdentity, AssessmentEntryImpl entry, IQTESTCourseNode cNode, ICourse course) {
    entry.setAssessmentStatus(AssessmentEntryStatus.notStarted);
    if (iqTestPersisterExists(assessedIdentity, cNode, course)) {
        entry.setAssessmentStatus(AssessmentEntryStatus.inProgress);
    } else {
        RepositoryEntry ref = cNode.getReferencedRepositoryEntry();
        if (ref != null) {
            Long courseResourceableId = course.getResourceableId();
            List<QTIResultSet> resultSets = qtiResultManager.getResultSets(courseResourceableId, cNode.getIdent(), ref.getKey(), assessedIdentity);
            if (resultSets.size() > 0) {
                if (OnyxModule.isOnyxTest(ref.getOlatResource())) {
                    // make it later with the flag fully assessed
                    entry.setAssessmentStatus(AssessmentEntryStatus.inProgress);
                } else if (checkEssay(ref)) {
                    entry.setAssessmentStatus(AssessmentEntryStatus.inReview);
                } else {
                    entry.setAssessmentStatus(AssessmentEntryStatus.done);
                }
            }
        }
    }
}
Also used : QTIResultSet(org.olat.ims.qti.QTIResultSet) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 14 with QTIResultSet

use of org.olat.ims.qti.QTIResultSet in project OpenOLAT by OpenOLAT.

the class IQManagerTest method testLastResultSet.

@Test
public void testLastResultSet() {
    RepositoryEntry re = createRepository();
    Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("iq-mgr-1");
    dbInstance.commit();
    long assessmentId = 836l;
    String resSubPath = "2687";
    // 3 try for id1
    QTIResultSet set1_1 = createSet(2.0f, assessmentId, id, re, resSubPath, modDate(3, 8, 5), modDate(3, 8, 20));
    QTIResultSet set1_3 = createSet(6.0f, assessmentId, id, re, resSubPath, modDate(3, 14, 8), modDate(3, 14, 32));
    QTIResultSet set1_2 = createSet(4.0f, assessmentId, id, re, resSubPath, modDate(3, 10, 35), modDate(3, 10, 55));
    dbInstance.commit();
    QTIResultSet lastSet = iqManager.getLastResultSet(id, re.getOlatResource().getResourceableId(), resSubPath);
    Assert.assertNotNull(lastSet);
    Assert.assertEquals(set1_3, lastSet);
    Assert.assertFalse(set1_1.equals(lastSet));
    Assert.assertFalse(set1_2.equals(lastSet));
}
Also used : QTIResultSet(org.olat.ims.qti.QTIResultSet) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 15 with QTIResultSet

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

the class IQManagerTest method testLastResultSet.

@Test
public void testLastResultSet() {
    RepositoryEntry re = createRepository();
    Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("iq-mgr-1");
    dbInstance.commit();
    long assessmentId = 836l;
    String resSubPath = "2687";
    // 3 try for id1
    QTIResultSet set1_1 = createSet(2.0f, assessmentId, id, re, resSubPath, modDate(3, 8, 5), modDate(3, 8, 20));
    QTIResultSet set1_3 = createSet(6.0f, assessmentId, id, re, resSubPath, modDate(3, 14, 8), modDate(3, 14, 32));
    QTIResultSet set1_2 = createSet(4.0f, assessmentId, id, re, resSubPath, modDate(3, 10, 35), modDate(3, 10, 55));
    dbInstance.commit();
    QTIResultSet lastSet = iqManager.getLastResultSet(id, re.getOlatResource().getResourceableId(), resSubPath);
    Assert.assertNotNull(lastSet);
    Assert.assertEquals(set1_3, lastSet);
    Assert.assertFalse(set1_1.equals(lastSet));
    Assert.assertFalse(set1_2.equals(lastSet));
}
Also used : QTIResultSet(org.olat.ims.qti.QTIResultSet) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Aggregations

QTIResultSet (org.olat.ims.qti.QTIResultSet)22 RepositoryEntry (org.olat.repository.RepositoryEntry)14 Identity (org.olat.core.id.Identity)8 Date (java.util.Date)6 Test (org.junit.Test)6 QTIResult (org.olat.ims.qti.QTIResult)6 ArrayList (java.util.ArrayList)4 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)4 AssessmentContext (org.olat.ims.qti.container.AssessmentContext)4 HttpItemInput (org.olat.ims.qti.container.HttpItemInput)4 ItemContext (org.olat.ims.qti.container.ItemContext)4 ItemInput (org.olat.ims.qti.container.ItemInput)4 SectionContext (org.olat.ims.qti.container.SectionContext)4 QTIStatisticSearchParams (org.olat.ims.qti.statistics.QTIStatisticSearchParams)4 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)4 Calendar (java.util.Calendar)2 List (java.util.List)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 Before (org.junit.Before)2 DB (org.olat.core.commons.persistence.DB)2