Search in sources :

Example 81 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class BulkAssessmentOverviewController method reloadTaskModel.

private void reloadTaskModel() {
    List<Task> tasks = taskManager.getTasks(courseEntry.getOlatResource());
    List<TaskData> taskDatas = new ArrayList<TaskData>(tasks.size());
    ICourse course = CourseFactory.loadCourse(courseEntry);
    Structure structure = course.getRunStructure();
    for (Task task : tasks) {
        String fullName = null;
        if (task.getCreator() != null) {
            fullName = userManager.getUserDisplayName(task.getCreator());
        }
        BulkAssessmentTask runnable = taskManager.getPersistedRunnableTask(task, BulkAssessmentTask.class);
        AssessableCourseNode courseNode = (AssessableCourseNode) structure.getNode(runnable.getCourseNodeIdent());
        taskDatas.add(new TaskData(task, runnable, courseNode, fullName));
    }
    taskModel.setObjects(taskDatas);
    taskListEl.reset();
    flc.contextPut("hasScheduledTasks", Boolean.valueOf(taskDatas.size() > 0));
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) Task(org.olat.core.commons.services.taskexecutor.Task) BulkAssessmentTask(org.olat.course.assessment.manager.BulkAssessmentTask) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) BulkAssessmentTask(org.olat.course.assessment.manager.BulkAssessmentTask) Structure(org.olat.course.Structure)

Example 82 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode 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)

Example 83 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class BulkAssessment_2b_ChooseColumnsStep method getStepController.

@Override
public StepFormController getStepController(UserRequest ureq, WindowControl wControl, StepsRunContext context, Form form) {
    // Skip this step if it has only return files
    AssessableCourseNode courseNode = (AssessableCourseNode) context.get("courseNode");
    BulkAssessmentSettings settings = new BulkAssessmentSettings(courseNode);
    boolean onlyReturnFiles = (!settings.isHasScore() && !settings.isHasPassed() && !settings.isHasUserComment());
    if (onlyReturnFiles) {
        return new ChooseColumnsStepSkipForm(ureq, wControl, context, form);
    } else {
        return new ChooseColumnsStepForm(ureq, wControl, savedColumnsSettings, context, form);
    }
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) BulkAssessmentSettings(org.olat.course.assessment.model.BulkAssessmentSettings)

Example 84 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class ScoreAccountingHelper method collectAssessableCourseNodes.

/**
 * Collects recursively all assessable course nodes
 *
 * @param node
 * @param nodeList
 */
private static void collectAssessableCourseNodes(CourseNode node, List<AssessableCourseNode> nodeList) {
    if (node instanceof AssessableCourseNode) {
        nodeList.add((AssessableCourseNode) node);
    }
    int count = node.getChildCount();
    for (int i = 0; i < count; i++) {
        CourseNode cn = (CourseNode) node.getChildAt(i);
        collectAssessableCourseNodes(cn, nodeList);
    }
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode)

Example 85 with AssessableCourseNode

use of org.olat.course.nodes.AssessableCourseNode in project OpenOLAT by OpenOLAT.

the class AssessmentHelper method getAssessmentNodeDataList.

public static int getAssessmentNodeDataList(int recursionLevel, CourseNode courseNode, ScoreAccounting scoreAccounting, UserCourseEnvironment userCourseEnv, boolean followUserVisibility, boolean discardEmptyNodes, boolean discardComments, List<AssessmentNodeData> data, AssessmentNodesLastModified lastModifications) {
    // 1) Get list of children data using recursion of this method
    AssessmentNodeData assessmentNodeData = new AssessmentNodeData(recursionLevel, courseNode);
    data.add(assessmentNodeData);
    int numOfChildren = 0;
    for (int i = 0; i < courseNode.getChildCount(); i++) {
        CourseNode child = (CourseNode) courseNode.getChildAt(i);
        numOfChildren += getAssessmentNodeDataList(recursionLevel + 1, child, scoreAccounting, userCourseEnv, followUserVisibility, discardEmptyNodes, discardComments, data, lastModifications);
    }
    // 2) Get data of this node only if
    // - it has any wrapped children  or
    // - it is of an assessable course node type
    boolean hasDisplayableValuesConfigured = false;
    boolean hasDisplayableUserValues = false;
    if (numOfChildren > 0 || courseNode instanceof AssessableCourseNode) {
        if (courseNode instanceof ProjectBrokerCourseNode) {
            // ProjectBroker : no assessment-tool in V1.0 , remove project broker completely form assessment-tool gui
            assessmentNodeData.setSelectable(false);
        } else if (courseNode instanceof AssessableCourseNode) {
            AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
            AssessmentEvaluation scoreEvaluation = scoreAccounting.evalCourseNode(assessableCourseNode);
            if (scoreEvaluation != null) {
                assessmentNodeData.setAssessmentStatus(scoreEvaluation.getAssessmentStatus());
                assessmentNodeData.setNumOfAssessmentDocs(scoreEvaluation.getNumOfAssessmentDocs());
            }
            assessmentNodeData.setUserVisibility(scoreEvaluation.getUserVisible());
            assessmentNodeData.setLastModified(scoreEvaluation.getLastModified());
            assessmentNodeData.setLastUserModified(scoreEvaluation.getLastUserModified());
            assessmentNodeData.setLastCoachModified(scoreEvaluation.getLastCoachModified());
            if (lastModifications != null) {
                lastModifications.addLastModified(scoreEvaluation.getLastModified());
                lastModifications.addLastUserModified(scoreEvaluation.getLastUserModified());
                lastModifications.addLastCoachModified(scoreEvaluation.getLastCoachModified());
            }
            if (!followUserVisibility || scoreEvaluation.getUserVisible() == null || scoreEvaluation.getUserVisible().booleanValue()) {
                // details
                if (assessableCourseNode.hasDetails()) {
                    hasDisplayableValuesConfigured = true;
                    String detailValue = assessableCourseNode.getDetailsListView(userCourseEnv);
                    if (detailValue == null) {
                        // ignore unset details in discardEmptyNodes mode
                        assessmentNodeData.setDetails(AssessmentHelper.DETAILS_NA_VALUE);
                    } else {
                        assessmentNodeData.setDetails(detailValue);
                        hasDisplayableUserValues = true;
                    }
                }
                // attempts
                if (assessableCourseNode.hasAttemptsConfigured()) {
                    hasDisplayableValuesConfigured = true;
                    Integer attemptsValue = scoreEvaluation.getAttempts();
                    if (attemptsValue != null) {
                        assessmentNodeData.setAttempts(attemptsValue);
                        if (attemptsValue.intValue() > 0) {
                            // ignore attempts = 0  in discardEmptyNodes mode
                            hasDisplayableUserValues = true;
                        }
                    }
                }
                // score
                if (assessableCourseNode.hasScoreConfigured()) {
                    hasDisplayableValuesConfigured = true;
                    Float score = scoreEvaluation.getScore();
                    if (score != null) {
                        assessmentNodeData.setRoundedScore(AssessmentHelper.getRoundedScore(score));
                        assessmentNodeData.setScore(score);
                        hasDisplayableUserValues = true;
                    }
                    if (!(assessableCourseNode instanceof STCourseNode)) {
                        assessmentNodeData.setMaxScore(assessableCourseNode.getMaxScoreConfiguration());
                        assessmentNodeData.setMinScore(assessableCourseNode.getMinScoreConfiguration());
                    }
                }
                // passed
                if (assessableCourseNode.hasPassedConfigured()) {
                    hasDisplayableValuesConfigured = true;
                    Boolean passed = scoreEvaluation.getPassed();
                    if (passed != null) {
                        assessmentNodeData.setPassed(passed);
                        hasDisplayableUserValues = true;
                    }
                }
            }
            // selection command available
            AssessableCourseNode acn = (AssessableCourseNode) courseNode;
            if (acn.isEditableConfigured()) {
                // Assessable course nodes are selectable
                assessmentNodeData.setSelectable(true);
            } else {
                // assessable nodes that do not have score or passed are not selectable
                // (e.g. a st node with no defined rule
                assessmentNodeData.setSelectable(false);
            }
            if (!hasDisplayableUserValues && assessableCourseNode.hasCommentConfigured() && !discardComments) {
                // comments are invisible in the table but if configured the node must be in the list
                // for the efficiency statement this can be ignored, this is the case when discardComments is true
                hasDisplayableValuesConfigured = true;
                if (assessableCourseNode.getUserUserComment(userCourseEnv) != null) {
                    hasDisplayableUserValues = true;
                }
            }
        } else {
            // Not assessable nodes are not selectable. (e.g. a node that
            // has an assessable child node but is itself not assessable)
            assessmentNodeData.setSelectable(false);
        }
    }
    // 3) Add data of this node to mast list if node assessable or children list has any data.
    // Do only add nodes when they have any assessable element, otherwhise discard (e.g. empty course,
    // structure nodes without scoring rules)! When the discardEmptyNodes flag is set then only
    // add this node when there is user data found for this node.
    boolean addNode = (numOfChildren > 0 || (discardEmptyNodes && hasDisplayableValuesConfigured && hasDisplayableUserValues) || (!discardEmptyNodes && hasDisplayableValuesConfigured));
    if (!addNode) {
        data.remove(assessmentNodeData);
        return 0;
    }
    // add itself
    return numOfChildren + 1;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) STCourseNode(org.olat.course.nodes.STCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) ProjectBrokerCourseNode(org.olat.course.nodes.ProjectBrokerCourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) AssessmentNodeData(org.olat.course.assessment.model.AssessmentNodeData) ProjectBrokerCourseNode(org.olat.course.nodes.ProjectBrokerCourseNode)

Aggregations

AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)118 CourseNode (org.olat.course.nodes.CourseNode)48 ICourse (org.olat.course.ICourse)40 Identity (org.olat.core.id.Identity)32 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)28 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)26 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)22 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)22 Date (java.util.Date)20 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)18 STCourseNode (org.olat.course.nodes.STCourseNode)18 ArrayList (java.util.ArrayList)16 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)16 CalculatedAssessableCourseNode (org.olat.course.nodes.CalculatedAssessableCourseNode)14 GTACourseNode (org.olat.course.nodes.GTACourseNode)12 File (java.io.File)10 IOException (java.io.IOException)10 WindowControl (org.olat.core.gui.control.WindowControl)10 MSCourseNode (org.olat.course.nodes.MSCourseNode)10 PersistentAssessableCourseNode (org.olat.course.nodes.PersistentAssessableCourseNode)10