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()));
}
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());
}
}
}
}
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);
}
}
}
}
}
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));
}
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));
}
Aggregations