Search in sources :

Example 56 with AssessmentTestSession

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

the class CorrectionIdentityListController method doSaveTests.

private void doSaveTests(UserRequest ureq) {
    Set<Integer> selections = tableEl.getMultiSelectedIndex();
    List<AssessmentTestSession> rows = new ArrayList<>(selections.size());
    for (Integer i : selections) {
        CorrectionIdentityRow row = tableModel.getObject(i.intValue());
        if (row != null) {
            rows.add(row.getCandidateSession());
        }
    }
    AssessmentTest assessmentTest = model.getResolvedAssessmentTest().getRootNodeLookup().extractIfSuccessful();
    fireEvent(ureq, new CompleteAssessmentTestSessionEvent(rows, assessmentTest, AssessmentEntryStatus.done));
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ArrayList(java.util.ArrayList) CompleteAssessmentTestSessionEvent(org.olat.modules.assessment.ui.event.CompleteAssessmentTestSessionEvent) CorrectionIdentityRow(org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityRow)

Example 57 with AssessmentTestSession

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

the class CorrectionIdentityListController method loadModel.

private void loadModel(boolean reset, boolean lastSessions) {
    if (lastSessions) {
        model.loadLastSessions();
    }
    List<AssessmentItemRef> itemRefs = model.getResolvedAssessmentTest().getAssessmentItemRefs();
    Map<String, AssessmentItemRef> identifierToItemRefMap = new HashMap<>();
    for (AssessmentItemRef itemRef : itemRefs) {
        identifierToItemRefMap.put(itemRef.getIdentifier().toString(), itemRef);
    }
    List<AssessmentItemSession> itemSessions = qtiService.getAssessmentItemSessions(model.getCourseEntry(), model.getSubIdent(), model.getTestEntry(), null);
    Map<ItemSessionKey, AssessmentItemSession> itemSessionMap = new HashMap<>();
    for (AssessmentItemSession itemSession : itemSessions) {
        AssessmentTestSession candidateSession = itemSession.getAssessmentTestSession();
        if (model.getReversedLastSessions().containsKey(candidateSession)) {
            // the map contains all test sessions the user is allowed to correct
            String itemRefIdentifier = itemSession.getAssessmentItemIdentifier();
            itemSessionMap.put(new ItemSessionKey(candidateSession.getKey(), itemRefIdentifier), itemSession);
        }
    }
    int count = 0;
    List<CorrectionIdentityRow> rows = new ArrayList<>(model.getNumberOfAssessedIdentities());
    Map<Identity, CorrectionIdentityRow> identityToRows = new HashMap<>();
    for (Map.Entry<Identity, AssessmentTestSession> entry : model.getLastSessions().entrySet()) {
        String user = translate("number.assessed.identity", new String[] { Integer.toString(++count) });
        CorrectionIdentityRow row = new CorrectionIdentityRow(user, entry.getKey(), entry.getValue(), userPropertyHandlers, getLocale());
        rows.add(row);
        identityToRows.put(entry.getKey(), row);
        TestSessionState testSessionState = model.getTestSessionStates().get(entry.getKey());
        for (Map.Entry<TestPlanNodeKey, ItemSessionState> itemEntry : testSessionState.getItemSessionStates().entrySet()) {
            String itemRefIdentifier = itemEntry.getKey().getIdentifier().toString();
            AssessmentItemRef itemRef = identifierToItemRefMap.get(itemRefIdentifier);
            AssessmentItemSession itemSession = itemSessionMap.get(new ItemSessionKey(entry.getValue().getKey(), itemRefIdentifier));
            appendStatistics(row, itemSession, itemEntry.getValue(), itemRef);
        }
    }
    tableModel.setObjects(rows);
    tableEl.reset(reset, reset, true);
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) HashMap(java.util.HashMap) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ArrayList(java.util.ArrayList) ItemSessionKey(org.olat.ims.qti21.ui.assessment.model.ItemSessionKey) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) Identity(org.olat.core.id.Identity) CorrectionIdentityRow(org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityRow) Map(java.util.Map) HashMap(java.util.HashMap) TestPlanNodeKey(uk.ac.ed.ph.jqtiplus.state.TestPlanNodeKey)

Example 58 with AssessmentTestSession

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

the class CorrectionAssessmentItemListController method doSelect.

private void doSelect(UserRequest ureq, AssessmentItemListEntry listEntry, List<? extends AssessmentItemListEntry> selectedItemSessions) {
    removeAsListenerAndDispose(identityItemCtrl);
    doUnlock();
    AssessmentItemRef itemRef = listEntry.getItemRef();
    AssessmentItemSession reloadItemSession = null;
    if (listEntry.getItemSession() != null) {
        reloadItemSession = qtiService.getAssessmentItemSession(listEntry.getItemSession());
    }
    // lock on item, need to check the lock on identity / test
    String lockSubKey = "item-" + listEntry.getAssessedIdentity().getKey() + "-" + listEntry.getItemRef().getIdentifier().toString();
    OLATResourceable testOres = OresHelper.clone(model.getTestEntry().getOlatResource());
    lockResult = CoordinatorManager.getInstance().getCoordinator().getLocker().acquireLock(testOres, getIdentity(), lockSubKey);
    if (lockResult.isSuccess()) {
        Identity assessedIdentity = listEntry.getAssessedIdentity();
        AssessmentTestSession candidateSession = listEntry.getTestSession();
        TestSessionState testSessionState = qtiService.loadTestSessionState(listEntry.getTestSession());
        List<TestPlanNode> nodes = testSessionState.getTestPlan().getNodes(itemRef.getIdentifier());
        if (nodes.size() == 1) {
            TestPlanNode itemNode = nodes.get(0);
            ItemSessionState itemSessionState = testSessionState.getItemSessionStates().get(itemNode.getKey());
            AssessmentItemCorrection itemCorrection = new AssessmentItemCorrection(assessedIdentity, candidateSession, testSessionState, reloadItemSession, itemSessionState, itemRef, itemNode);
            itemCorrection.setItemSession(reloadItemSession);
            identityItemCtrl = new CorrectionIdentityAssessmentItemNavigationController(ureq, getWindowControl(), model.getTestEntry(), model.getResolvedAssessmentTest(), itemCorrection, listEntry, selectedItemSessions, model);
            listenTo(identityItemCtrl);
            updatePreviousNext();
            stackPanel.pushController(listEntry.getLabel(), identityItemCtrl);
        }
    } else {
        String lockOwnerName = userManager.getUserDisplayName(lockResult.getOwner());
        showWarning("warning.assessment.item.locked", new String[] { lockOwnerName });
    }
}
Also used : TestPlanNode(uk.ac.ed.ph.jqtiplus.state.TestPlanNode) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) TestSessionState(uk.ac.ed.ph.jqtiplus.state.TestSessionState) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) AssessmentItemCorrection(org.olat.ims.qti21.ui.assessment.model.AssessmentItemCorrection) Identity(org.olat.core.id.Identity)

Example 59 with AssessmentTestSession

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

the class CorrectionAssessmentItemListController method doSelect.

private void doSelect(UserRequest ureq, CorrectionAssessmentItemRow row, Predicate<AssessmentItemListEntry> filter) {
    removeAsListenerAndDispose(identityItemCtrl);
    AssessmentItemRef itemRef = row.getItemRef();
    String itemRefIdentifier = row.getItemRef().getIdentifier().toString();
    List<AssessmentItemSession> allItemSessions = qtiService.getAssessmentItemSessions(model.getCourseEntry(), model.getSubIdent(), model.getTestEntry(), itemRefIdentifier);
    Map<AssessmentTestSession, AssessmentItemSession> testToItemSession = new HashMap<>();
    for (AssessmentItemSession itemSession : allItemSessions) {
        AssessmentTestSession testSession = itemSession.getAssessmentTestSession();
        testToItemSession.put(testSession, itemSession);
    }
    // reorder to match the list of identities
    int count = 1;
    List<Identity> assessedIdentities = model.getAssessedIdentities();
    List<AssessmentItemListEntry> reorderItemSessions = new ArrayList<>(assessedIdentities.size());
    for (Identity assessedIdentity : assessedIdentities) {
        AssessmentTestSession testSession = model.getLastSessions().get(assessedIdentity);
        if (testSession != null) {
            AssessmentItemSession itemSession = testToItemSession.get(testSession);
            String title;
            if (anonymous) {
                title = translate("number.assessed.identity", new String[] { Integer.toString(count++) });
            } else {
                title = userManager.getUserDisplayName(assessedIdentity);
            }
            AssessmentItemListEntry entry = new AssessmentItemListEntry(assessedIdentity, testSession, itemSession, itemRef, title, "o_icon_user");
            if (filter.test(entry)) {
                reorderItemSessions.add(entry);
            }
        }
    }
    if (!reorderItemSessions.isEmpty()) {
        doSelect(ureq, reorderItemSessions.get(0), reorderItemSessions);
    } else {
        showWarning("waring.atleast.one");
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) HashMap(java.util.HashMap) AssessmentItemListEntry(org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry) ArrayList(java.util.ArrayList) AssessmentItemSession(org.olat.ims.qti21.AssessmentItemSession) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) Identity(org.olat.core.id.Identity)

Example 60 with AssessmentTestSession

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

the class IQConfigurationController method cleanUpQti21PreviewSession.

/**
 * Delete the test session created by the preview controller
 * for the QTI 2.1 tests.
 */
private void cleanUpQti21PreviewSession() {
    if (previewQTI21Ctrl != null) {
        AssessmentTestSession previewSession = previewQTI21Ctrl.getCandidateSession();
        qti21service.deleteAssessmentTestSession(previewSession);
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession)

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