Search in sources :

Example 6 with BulkAssessmentDatas

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);
}
Also used : BulkAssessmentDatas(org.olat.course.assessment.model.BulkAssessmentDatas) BulkAssessmentColumnSettings(org.olat.course.assessment.model.BulkAssessmentColumnSettings) HashMap(java.util.HashMap) BulkAssessmentRow(org.olat.course.assessment.model.BulkAssessmentRow)

Example 7 with BulkAssessmentDatas

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);
}
Also used : BulkAssessmentDatas(org.olat.course.assessment.model.BulkAssessmentDatas) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) ArrayList(java.util.ArrayList) BulkAssessmentRow(org.olat.course.assessment.model.BulkAssessmentRow)

Example 8 with BulkAssessmentDatas

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);
}
Also used : BulkAssessmentDatas(org.olat.course.assessment.model.BulkAssessmentDatas) ArrayList(java.util.ArrayList) BulkAssessmentRow(org.olat.course.assessment.model.BulkAssessmentRow)

Example 9 with BulkAssessmentDatas

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));
}
Also used : BulkAssessmentDatas(org.olat.course.assessment.model.BulkAssessmentDatas)

Example 10 with BulkAssessmentDatas

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());
    }
}
Also used : Task(org.olat.core.commons.services.taskexecutor.Task) BulkAssessmentTask(org.olat.course.assessment.manager.BulkAssessmentTask) Step(org.olat.core.gui.control.generic.wizard.Step) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) Date(java.util.Date) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) BulkAssessmentDatas(org.olat.course.assessment.model.BulkAssessmentDatas) BulkAssessmentFeedback(org.olat.course.assessment.model.BulkAssessmentFeedback) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) BulkAssessmentTask(org.olat.course.assessment.manager.BulkAssessmentTask) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Aggregations

BulkAssessmentDatas (org.olat.course.assessment.model.BulkAssessmentDatas)14 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 UserRequest (org.olat.core.gui.UserRequest)6 WindowControl (org.olat.core.gui.control.WindowControl)6 Step (org.olat.core.gui.control.generic.wizard.Step)6 StepRunnerCallback (org.olat.core.gui.control.generic.wizard.StepRunnerCallback)6 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)6 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)6 BulkAssessmentFeedback (org.olat.course.assessment.model.BulkAssessmentFeedback)6 BulkAssessmentRow (org.olat.course.assessment.model.BulkAssessmentRow)6 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)4 HashMap (java.util.HashMap)2 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)2 Task (org.olat.core.commons.services.taskexecutor.Task)2 ICourse (org.olat.course.ICourse)2 BulkAssessmentTask (org.olat.course.assessment.manager.BulkAssessmentTask)2 BulkAssessmentColumnSettings (org.olat.course.assessment.model.BulkAssessmentColumnSettings)2