use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow in project OpenOLAT by OpenOLAT.
the class CorrectionIdentityAssessmentItemListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("select".equals(cmd)) {
CorrectionIdentityAssessmentItemRow row = tableModel.getObject(se.getIndex());
doSelect(ureq, row);
}
}
} else if (saveButton == source) {
List<AssessmentTestSession> sessions = Collections.singletonList(candidateSession);
AssessmentTest assessmentTest = model.getResolvedAssessmentTest().getRootNodeLookup().extractIfSuccessful();
fireEvent(ureq, new CompleteAssessmentTestSessionEvent(sessions, assessmentTest, AssessmentEntryStatus.done));
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow in project OpenOLAT by OpenOLAT.
the class CorrectionIdentityAssessmentItemListController method updatePreviousNext.
private void updatePreviousNext() {
if (identityItemCtrl != null) {
List<CorrectionIdentityAssessmentItemRow> rows = tableModel.getObjects();
AssessmentItemListEntry itemSession = identityItemCtrl.getAssessmentItemSession();
String previousText = translate("previous.item");
String nextText = translate("next.item");
boolean previousEnable = false;
boolean nextEnable = false;
int index = rows.indexOf(itemSession);
if (index - 1 >= 0 && rows.size() > index - 1) {
previousText = rows.get(index - 1).getLabel();
previousEnable = true;
}
if (index + 1 >= 0 && rows.size() > index + 1) {
nextText = rows.get(index + 1).getLabel();
nextEnable = true;
}
identityItemCtrl.updatePreviousNext(previousText, previousEnable, nextText, nextEnable);
}
}
use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow in project OpenOLAT by OpenOLAT.
the class CorrectionIdentityAssessmentItemListController method doSelect.
private void doSelect(UserRequest ureq, CorrectionIdentityAssessmentItemRow row) {
removeAsListenerAndDispose(identityItemCtrl);
doUnlock();
AssessmentItemRef itemRef = row.getItemRef();
TestSessionState testSessionState = qtiService.loadTestSessionState(candidateSession);
List<TestPlanNode> nodes = testSessionState.getTestPlan().getNodes(itemRef.getIdentifier());
AssessmentItemSession reloadItemSession = null;
if (nodes.size() == 1) {
TestPlanNode itemNode = nodes.get(0);
String stringuifiedIdentifier = itemNode.getKey().getIdentifier().toString();
ParentPartItemRefs parentParts = AssessmentTestHelper.getParentSection(itemNode.getKey(), testSessionState, model.getResolvedAssessmentTest());
reloadItemSession = qtiService.getOrCreateAssessmentItemSession(candidateSession, parentParts, stringuifiedIdentifier);
}
// lock on item, need to check the lock on identity / test
String lockSubKey = "item-" + reloadItemSession.getKey();
OLATResourceable testOres = OresHelper.clone(model.getTestEntry().getOlatResource());
lockResult = CoordinatorManager.getInstance().getCoordinator().getLocker().acquireLock(testOres, getIdentity(), lockSubKey);
if (lockResult.isSuccess()) {
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);
ResolvedAssessmentItem resolvedAssessmentItem = model.getResolvedAssessmentTest().getResolvedAssessmentItem(itemRef);
AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
identityItemCtrl = new CorrectionIdentityAssessmentItemNavigationController(ureq, getWindowControl(), model.getTestEntry(), model.getResolvedAssessmentTest(), itemCorrection, row, tableModel.getObjects(), model);
listenTo(identityItemCtrl);
stackPanel.pushController(assessmentItem.getTitle(), identityItemCtrl);
updatePreviousNext();
}
} else {
String lockOwnerName = userManager.getUserDisplayName(lockResult.getOwner());
showWarning("warning.assessment.item.locked", new String[] { lockOwnerName });
}
}
use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow in project OpenOLAT by OpenOLAT.
the class CorrectionIdentityAssessmentItemTableSort method sort.
@Override
protected void sort(List<CorrectionIdentityAssessmentItemRow> rows) {
int columnIndex = getColumnIndex();
IdentityItemCols column = IdentityItemCols.values()[columnIndex];
switch(column) {
case itemType:
Collections.sort(rows, new QuestionTypeComparator());
break;
case corrected:
Collections.sort(rows, new CorrectedComparator());
break;
case notCorrected:
Collections.sort(rows, new NotCorrectedComparator());
break;
default:
super.sort(rows);
}
}
use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow in project openolat by klemens.
the class CorrectionIdentityAssessmentItemListController method loadModel.
private void loadModel(boolean reset) {
ResolvedAssessmentTest resolvedAssessmentTest = model.getResolvedAssessmentTest();
Map<Identifier, AssessmentItemRef> identifierToRefs = new HashMap<>();
for (AssessmentItemRef itemRef : resolvedAssessmentTest.getAssessmentItemRefs()) {
identifierToRefs.put(itemRef.getIdentifier(), itemRef);
}
List<AssessmentItemSession> allItemSessions = qtiService.getAssessmentItemSessions(candidateSession);
Map<String, AssessmentItemSession> identifierToItemSessions = new HashMap<>();
for (AssessmentItemSession itemSession : allItemSessions) {
identifierToItemSessions.put(itemSession.getAssessmentItemIdentifier(), itemSession);
}
// reorder to match the list of assessment items
List<CorrectionIdentityAssessmentItemRow> rows = new ArrayList<>();
TestSessionState testSessionState = model.getTestSessionStates().get(assessedIdentity);
List<TestPlanNode> nodes = testSessionState.getTestPlan().getTestPlanNodeList();
for (TestPlanNode node : nodes) {
if (node.getTestNodeType() == TestNodeType.ASSESSMENT_ITEM_REF) {
TestPlanNodeKey key = node.getKey();
AssessmentItemRef itemRef = identifierToRefs.get(key.getIdentifier());
AssessmentItemSession itemSession = identifierToItemSessions.get(key.getIdentifier().toString());
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
ManifestMetadataBuilder metadata = model.getMetadata(itemRef);
AssessmentItem item = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
ItemSessionState itemSessionState = testSessionState.getItemSessionStates().get(key);
boolean manualCorrection = model.isManualCorrection(itemRef);
CorrectionIdentityAssessmentItemRow row = new CorrectionIdentityAssessmentItemRow(assessedIdentity, item, itemRef, metadata, candidateSession, itemSession, itemSessionState, manualCorrection);
row.setTitle(title);
row.setTitleCssClass("o_icon_user");
rows.add(row);
}
}
tableModel.setObjects(rows);
tableEl.reset(reset, reset, true);
}
Aggregations