use of org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow 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.CorrectionAssessmentItemRow in project OpenOLAT by OpenOLAT.
the class CorrectionAssessmentItemListController method doConfirmSaveTests.
private void doConfirmSaveTests(UserRequest ureq) {
int notCorrectedQuestions = 0;
List<CorrectionAssessmentItemRow> rows = tableModel.getObjects();
for (CorrectionAssessmentItemRow row : rows) {
notCorrectedQuestions += row.getNumNotCorrected();
}
confirmSaveTestCtrl = new ConfirmSaveTestsController(ureq, getWindowControl(), notCorrectedQuestions > 0);
listenTo(confirmSaveTestCtrl);
cmc = new CloseableModalController(getWindowControl(), "close", confirmSaveTestCtrl.getInitialComponent(), true, translate("save.tests"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow in project OpenOLAT by OpenOLAT.
the class CorrectionAssessmentItemTableSort method sort.
@Override
protected void sort(List<CorrectionAssessmentItemRow> rows) {
int columnIndex = getColumnIndex();
ItemCols column = ItemCols.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.CorrectionAssessmentItemRow in project openolat by klemens.
the class CorrectionAssessmentItemListController method doConfirmSaveTests.
private void doConfirmSaveTests(UserRequest ureq) {
int notCorrectedQuestions = 0;
List<CorrectionAssessmentItemRow> rows = tableModel.getObjects();
for (CorrectionAssessmentItemRow row : rows) {
notCorrectedQuestions += row.getNumNotCorrected();
}
confirmSaveTestCtrl = new ConfirmSaveTestsController(ureq, getWindowControl(), notCorrectedQuestions > 0);
listenTo(confirmSaveTestCtrl);
cmc = new CloseableModalController(getWindowControl(), "close", confirmSaveTestCtrl.getInitialComponent(), true, translate("save.tests"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.ims.qti21.ui.assessment.model.CorrectionAssessmentItemRow in project openolat by klemens.
the class CorrectionAssessmentItemListController method loadModel.
private void loadModel(boolean reset, boolean lastSessions) {
if (lastSessions) {
model.loadLastSessions();
}
ResolvedAssessmentTest resolvedAssessmentTest = model.getResolvedAssessmentTest();
List<AssessmentItemRef> itemRefs = resolvedAssessmentTest.getAssessmentItemRefs();
List<CorrectionAssessmentItemRow> itemRows = new ArrayList<>(itemRefs.size());
Map<String, CorrectionAssessmentItemRow> itemRefIdToRows = new HashMap<>();
for (AssessmentItemRef itemRef : itemRefs) {
ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
ManifestMetadataBuilder metadata = model.getMetadata(itemRef);
FormLink toolsLink = uifactory.addFormLink("tools_" + (++counter), "tools", "", null, null, Link.NONTRANSLATED);
toolsLink.setIconLeftCSS("o_icon o_icon_actions o_icon-lg");
CorrectionAssessmentItemRow itemRow = new CorrectionAssessmentItemRow(itemRef, assessmentItem, metadata, toolsLink);
toolsLink.setUserObject(itemRow);
itemRows.add(itemRow);
itemRefIdToRows.put(itemRef.getIdentifier().toString(), itemRow);
}
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);
}
}
for (Map.Entry<Identity, AssessmentTestSession> entry : model.getLastSessions().entrySet()) {
if (model.getLastSessions().containsKey(entry.getKey())) {
TestSessionState testSessionState = model.getTestSessionStates().get(entry.getKey());
for (Map.Entry<TestPlanNodeKey, ItemSessionState> itemEntry : testSessionState.getItemSessionStates().entrySet()) {
String itemRefIdentifier = itemEntry.getKey().getIdentifier().toString();
CorrectionAssessmentItemRow row = itemRefIdToRows.get(itemRefIdentifier);
if (row != null) {
AssessmentItemSession itemSession = itemSessionMap.get(new ItemSessionKey(entry.getValue().getKey(), itemRefIdentifier));
appendStatistics(row, itemSession, itemEntry.getValue());
}
}
}
}
tableModel.setObjects(itemRows);
tableEl.reset(reset, reset, true);
}
Aggregations