use of org.olat.course.assessment.model.BulkAssessmentDatas in project openolat by klemens.
the class ChooseColumnsStepForm method formOK.
@Override
protected void formOK(UserRequest ureq) {
BulkAssessmentDatas datas = (BulkAssessmentDatas) getFromRunContext("datas");
List<BulkAssessmentRow> rows = datas.getRows();
Map<String, BulkAssessmentRow> assessedIdToRow = new HashMap<>();
for (BulkAssessmentRow row : rows) {
assessedIdToRow.put(row.getAssessedId(), row);
}
BulkAssessmentColumnSettings settings = datas.getColumnsSettings();
if (settings == null) {
settings = new BulkAssessmentColumnSettings();
datas.setColumnsSettings(settings);
}
settings.setUsernameColumn(getColumnPosition(userNameColumnEl));
settings.setScoreColumn(getColumnPosition(scoreColumnEl));
settings.setPassedColumn(getColumnPosition(passedColumnEl));
settings.setCommentColumn(getColumnPosition(commentColumnEl));
List<String[]> splittedRows = overviewDataModel.getObjects();
for (String[] values : splittedRows) {
createRow(values, settings, rows, assessedIdToRow);
}
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
}
use of org.olat.course.assessment.model.BulkAssessmentDatas in project openolat by klemens.
the class DataStepForm method formOK.
@Override
protected void formOK(UserRequest ureq) {
String val = dataEl.getValue();
if (!StringHelper.containsNonWhitespace(val) && (returnFileEl != null ? !returnFileEl.isUploadSuccess() : true)) {
// do not proceed when nothin in input field and no file uploaded
setFormWarning("form.step2.error");
return;
}
// reset error
setFormWarning(null);
BulkAssessmentDatas datas = (BulkAssessmentDatas) getFromRunContext("datas");
if (datas == null) {
datas = new BulkAssessmentDatas();
}
if (bulkAssessmentTmpDir == null) {
OlatRootFolderImpl bulkAssessmentDir = new OlatRootFolderImpl("/bulkassessment/", null);
bulkAssessmentTmpDir = bulkAssessmentDir.createChildContainer(UUID.randomUUID().toString());
}
backupInputDatas(val, datas, bulkAssessmentTmpDir);
List<String[]> splittedRows = splitRawData(val);
addToRunContext("splittedRows", splittedRows);
List<BulkAssessmentRow> rows = new ArrayList<>(100);
if (returnFileEl != null) {
processReturnFiles(datas, rows, bulkAssessmentTmpDir);
}
datas.setRows(rows);
addToRunContext("datas", datas);
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
}
use of org.olat.course.assessment.model.BulkAssessmentDatas in project OpenOLAT by OpenOLAT.
the class ValidationStepForm method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (validModel.getRowCount() == 0) {
// do not continue wizard without valid data
return;
}
BulkAssessmentDatas datas = (BulkAssessmentDatas) getFromRunContext("datas");
List<BulkAssessmentRow> rows = new ArrayList<>(validModel.getRowCount() + invalidModel.getRowCount());
for (int i = validModel.getRowCount(); i-- > 0; ) {
rows.add(validModel.getObject(i).getRow());
}
for (int i = invalidModel.getRowCount(); i-- > 0; ) {
rows.add(invalidModel.getObject(i).getRow());
}
datas.setRows(rows);
addToRunContext("datas", datas);
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
}
use of org.olat.course.assessment.model.BulkAssessmentDatas in project OpenOLAT by OpenOLAT.
the class ValidationStepForm method doValidate.
private void doValidate() {
BulkAssessmentDatas datas = (BulkAssessmentDatas) getFromRunContext("datas");
if (datas.getRows() != null) {
doValidateRows(datas);
}
flc.contextPut("hasNoItems", Boolean.valueOf(datas.getRows() == null || datas.getRows().size() == 0));
}
use of org.olat.course.assessment.model.BulkAssessmentDatas in project OpenOLAT by OpenOLAT.
the class BulkAssessmentOverviewController method doEditBulkAssessment.
private void doEditBulkAssessment(UserRequest ureq, TaskData data) {
removeAsListenerAndDispose(bulkAssessmentCtrl);
if (editedTask != null) {
// only for security purpose
taskManager.returnTaskAfterEdition(editedTask, null);
}
AssessableCourseNode courseNode = data.getCourseNode();
final Task editableTask = taskManager.pickTaskForEdition(data.getTask());
editedTask = editableTask;
if (editableTask == null) {
showWarning("task.edited");
} else {
BulkAssessmentTask runnable = taskManager.getPersistedRunnableTask(editableTask, BulkAssessmentTask.class);
BulkAssessmentDatas datas = runnable.getDatas();
Step start = new BulkAssessment_2_DatasStep(ureq, courseNode, datas, editableTask);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
Task task = (Task) runContext.get("task");
Date scheduledDate = (Date) runContext.get("scheduledDate");
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) runContext.get("courseNode");
BulkAssessmentDatas bulkDatas = (BulkAssessmentDatas) runContext.get("datas");
Feedback feedback = doUpdateBulkAssessment(task, assessableCourseNode, scheduledDate, bulkDatas);
runContext.put("feedback", feedback);
editedTask = null;
return StepsMainRunController.DONE_MODIFIED;
}
};
StepRunnerCallback cancel = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
taskManager.returnTaskAfterEdition(editableTask, null);
editedTask = null;
return Step.NOSTEP;
}
};
bulkAssessmentCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, cancel, translate("bulk.wizard.title"), "o_sel_bulk_assessment_wizard");
listenTo(bulkAssessmentCtrl);
getWindowControl().pushAsModalDialog(bulkAssessmentCtrl.getInitialComponent());
}
}
Aggregations