use of org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry in project OpenOLAT by OpenOLAT.
the class CorrectionAssessmentItemListController 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();
CorrectionAssessmentItemRow row = tableModel.getObject(se.getIndex());
if ("select".equals(cmd)) {
// accept all
doSelect(ureq, row, r -> true);
} else if ("answered".equals(cmd)) {
// accept all
doSelect(ureq, row, new ResponsedPredicate(row, true));
} else if ("notAnswered".equals(cmd)) {
// accept all
doSelect(ureq, row, new ResponsedPredicate(row, false));
} else if ("autoCorrected".equals(cmd)) {
doSelect(ureq, row, entry -> !row.isManualCorrection() && entry.getManualScore() == null);
} else if ("corrected".equals(cmd)) {
doSelect(ureq, row, entry -> entry.getManualScore() != null);
} else if ("notCorrected".equals(cmd)) {
doSelect(ureq, row, entry -> row.isManualCorrection() && entry.getManualScore() == null);
} else if ("toReview".equals(cmd)) {
doSelect(ureq, row, AssessmentItemListEntry::isToReview);
}
}
} else if (saveTestsButton == source) {
doConfirmSaveTests(ureq);
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
if ("tools".equals(link.getCmd())) {
doOpenTools(ureq, (CorrectionAssessmentItemRow) link.getUserObject(), link);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry in project OpenOLAT by OpenOLAT.
the class CorrectionAssessmentItemListController method updatePreviousNext.
private void updatePreviousNext() {
if (identityItemCtrl != null) {
AssessmentItemListEntry itemSession = identityItemCtrl.getAssessmentItemSession();
List<? extends AssessmentItemListEntry> selectedItemSessions = identityItemCtrl.getAssessmentEntryList();
String previousText = translate("previous.user");
String nextText = translate("next.user");
boolean previousEnable = false;
boolean nextEnable = false;
int index = selectedItemSessions.indexOf(itemSession);
if (index - 1 >= 0 && selectedItemSessions.size() > index - 1) {
previousText = selectedItemSessions.get(index - 1).getLabel();
previousEnable = true;
}
if (index + 1 >= 0 && selectedItemSessions.size() > index + 1) {
nextText = selectedItemSessions.get(index + 1).getLabel();
nextEnable = true;
}
identityItemCtrl.updatePreviousNext(previousText, previousEnable, nextText, nextEnable);
}
}
use of org.olat.ims.qti21.ui.assessment.model.AssessmentItemListEntry in project OpenOLAT by OpenOLAT.
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.ui.assessment.model.AssessmentItemListEntry 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.AssessmentItemListEntry in project OpenOLAT by OpenOLAT.
the class CorrectionIdentityAssessmentItemNavigationController method doSelectByIndex.
private void doSelectByIndex(UserRequest ureq, int index) {
List<? extends AssessmentItemListEntry> assessmentEntryList = getAssessmentEntryList();
if (index >= 0 && index < assessmentEntryList.size()) {
AssessmentItemListEntry nextEntry = assessmentEntryList.get(index);
fireEvent(ureq, new SelectAssessmentItemEvent(nextEntry));
}
}
Aggregations