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