Search in sources :

Example 66 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project openolat by klemens.

the class ConfirmExtraTimeController method sessionToFullnames.

private String sessionToFullnames() {
    StringBuilder sb = new StringBuilder();
    for (AssessmentTestSession testSession : testSessions) {
        Identity identity = testSession.getIdentity();
        if (identity != null) {
            String fullname = userManager.getUserDisplayName(identity);
            if (sb.length() > 0)
                sb.append(", ");
            sb.append(fullname);
        }
    }
    return sb.toString();
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) Identity(org.olat.core.id.Identity)

Example 67 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class AssessmentTestSessionDAOTest method hasActiveTestSession.

@Test
public void hasActiveTestSession() {
    // prepare a test and a user
    RepositoryEntry testEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    Identity assessedIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("session-4");
    AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, testEntry, null, testEntry);
    dbInstance.commit();
    // create an assessment test session
    AssessmentTestSession testSession1 = testSessionDao.createAndPersistTestSession(testEntry, null, null, assessmentEntry, assessedIdentity, null, false);
    Assert.assertNotNull(testSession1);
    dbInstance.commitAndCloseSession();
    // check
    boolean hasTestSession = testSessionDao.hasActiveTestSession(testEntry);
    Assert.assertTrue(hasTestSession);
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Test(org.junit.Test)

Example 68 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class AssessmentTestSessionDAOTest method getUserTestSessionsStatistics.

@Test
public void getUserTestSessionsStatistics() {
    // prepare a test and a user
    RepositoryEntry testEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    RepositoryEntry courseEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    String subIdent = UUID.randomUUID().toString();
    Identity assessedIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("session-3");
    AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, courseEntry, subIdent, testEntry);
    dbInstance.commit();
    AssessmentTestSession testSession = testSessionDao.createAndPersistTestSession(testEntry, courseEntry, subIdent, assessmentEntry, assessedIdentity, null, false);
    Assert.assertNotNull(testSession);
    dbInstance.commit();
    for (int i = 0; i < 4; i++) {
        ParentPartItemRefs parentParts = new ParentPartItemRefs();
        String sectionIdentifier = UUID.randomUUID().toString();
        parentParts.setSectionIdentifier(sectionIdentifier);
        String testPartIdentifier = UUID.randomUUID().toString();
        parentParts.setTestPartIdentifier(testPartIdentifier);
        AssessmentItemSession itemSession = itemSessionDao.createAndPersistAssessmentItemSession(testSession, parentParts, UUID.randomUUID().toString());
        Assert.assertNotNull(itemSession);
        dbInstance.commit();
        if (i % 2 == 0) {
            itemSession.setManualScore(new BigDecimal(3));
            itemSessionDao.merge(itemSession);
        }
    }
    dbInstance.commitAndCloseSession();
    List<AssessmentTestSessionStatistics> sessionsStatistics = testSessionDao.getUserTestSessionsStatistics(courseEntry, subIdent, assessedIdentity);
    Assert.assertNotNull(sessionsStatistics);
    Assert.assertEquals(1, sessionsStatistics.size());
    AssessmentTestSessionStatistics sessionStatistics = sessionsStatistics.get(0);
    Assert.assertNotNull(sessionStatistics.getTestSession());
    Assert.assertEquals(testSession, sessionStatistics.getTestSession());
    Assert.assertEquals(2, sessionStatistics.getNumOfCorrectedItems());
}
Also used : ParentPartItemRefs(org.olat.ims.qti21.model.ParentPartItemRefs) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) AssessmentTestSessionStatistics(org.olat.ims.qti21.model.jpa.AssessmentTestSessionStatistics) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 69 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class AssessmentTestSessionDAOTest method hasActiveTestSession_negative.

@Test
public void hasActiveTestSession_negative() {
    // prepare a test and a user
    RepositoryEntry testEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    Identity assessedIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("session-5");
    AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, testEntry, null, testEntry);
    dbInstance.commit();
    // create an assessment test session
    AssessmentTestSession testSession1 = testSessionDao.createAndPersistTestSession(testEntry, null, null, assessmentEntry, assessedIdentity, null, true);
    Assert.assertNotNull(testSession1);
    dbInstance.commitAndCloseSession();
    // check that there isn't any active test session (only author mode)
    boolean hasTestSession = testSessionDao.hasActiveTestSession(testEntry);
    Assert.assertFalse(hasTestSession);
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Test(org.junit.Test)

Example 70 with AssessmentTestSession

use of org.olat.ims.qti21.AssessmentTestSession in project OpenOLAT by OpenOLAT.

the class AssessmentTestSessionDAOTest method createTestSession_course.

@Test
public void createTestSession_course() {
    // prepare a test and a user
    RepositoryEntry testEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    RepositoryEntry courseEntry = JunitTestHelper.createAndPersistRepositoryEntry();
    String subIdent = UUID.randomUUID().toString();
    Identity assessedIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("session-2");
    AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, courseEntry, subIdent, testEntry);
    dbInstance.commit();
    AssessmentTestSession testSession = testSessionDao.createAndPersistTestSession(testEntry, courseEntry, subIdent, assessmentEntry, assessedIdentity, null, false);
    Assert.assertNotNull(testSession);
    dbInstance.commit();
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Test(org.junit.Test)

Aggregations

AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)107 Identity (org.olat.core.id.Identity)45 RepositoryEntry (org.olat.repository.RepositoryEntry)36 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)32 File (java.io.File)30 ArrayList (java.util.ArrayList)24 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)24 Date (java.util.Date)22 Test (org.junit.Test)20 TestSessionState (uk.ac.ed.ph.jqtiplus.state.TestSessionState)20 HashMap (java.util.HashMap)17 InMemoryAssessmentTestSession (org.olat.ims.qti21.model.InMemoryAssessmentTestSession)14 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)14 AssessmentResponse (org.olat.ims.qti21.AssessmentResponse)12 TestPlanNodeKey (uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)12 IOException (java.io.IOException)10 BigDecimal (java.math.BigDecimal)10 CandidateEvent (org.olat.ims.qti21.model.audit.CandidateEvent)10 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)10 ResolvedAssessmentTest (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest)10