Search in sources :

Example 66 with AssessableCourseNode

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

the class ScoreAccounting method evalScoreOfCourseNode.

/**
 * Evaluate the score of the course element. The method
 * takes the visibility of the results in account and will
 * return 0.0 if the results are not visiblity.
 *
 * @param childId The specified course element ident
 * @return A float (never null)
 */
public Float evalScoreOfCourseNode(String childId) {
    CourseNode foundNode = findChildByID(childId);
    Float score = null;
    if (foundNode instanceof AssessableCourseNode) {
        AssessableCourseNode acn = (AssessableCourseNode) foundNode;
        ScoreEvaluation se = evalCourseNode(acn);
        if (se != null) {
            // the node could not provide any sensible information on scoring. e.g. a STNode with no calculating rules
            if (se.getUserVisible() == null || se.getUserVisible().booleanValue()) {
                score = se.getScore();
            } else {
                score = new Float(0.0f);
            }
        }
        if (score == null) {
            // a child has no score yet
            // default to 0.0, so that the condition can be evaluated (zero points makes also the most sense for "no results yet", if to be expressed in a number)
            score = new Float(0.0f);
        }
    } else {
        error = true;
        score = new Float(0.0f);
    }
    return score;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode)

Example 67 with AssessableCourseNode

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

the class ScoreAccounting method evalPassedOfCourseNode.

/**
 * Evaluate the passed / failed state of a course element. The method
 * takes the visibility of the results in account and will return false
 * if the results are not visible.
 *
 * @param childId The specified course element ident
 * @return true/false never null
 */
public Boolean evalPassedOfCourseNode(String childId) {
    CourseNode foundNode = findChildByID(childId);
    if (foundNode == null) {
        error = true;
        return Boolean.FALSE;
    }
    if (!(foundNode instanceof AssessableCourseNode)) {
        error = true;
        return Boolean.FALSE;
    }
    AssessableCourseNode acn = (AssessableCourseNode) foundNode;
    ScoreEvaluation se = evalCourseNode(acn);
    if (se == null) {
        // the node could not provide any sensible information on scoring. e.g. a STNode with no calculating rules
        log.error("could not evaluate node '" + acn.getShortTitle() + "' (" + acn.getClass().getName() + "," + childId + ")", null);
        return Boolean.FALSE;
    }
    // check if the results are visible
    if (se.getUserVisible() != null && !se.getUserVisible().booleanValue()) {
        return Boolean.FALSE;
    }
    Boolean passed = se.getPassed();
    if (passed == null) {
        // a child has no "Passed" yet
        passed = Boolean.FALSE;
    }
    return passed;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode)

Example 68 with AssessableCourseNode

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

the class ScoreAccounting method evaluateAll.

public boolean evaluateAll(boolean update) {
    Identity identity = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    List<AssessmentEntry> entries = userCourseEnvironment.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(identity);
    AssessableTreeVisitor visitor = new AssessableTreeVisitor(entries, update);
    // collect all assessable nodes and eval 'em
    CourseNode root = userCourseEnvironment.getCourseEnvironment().getRunStructure().getRootNode();
    // breadth first traversal gives an easier order of evaluation for debugging
    // however, for live it is absolutely mandatory to use depth first since using breadth first
    // the score accoutings local cache hash map will never be used. this can slow down things like
    // crazy (course with 10 tests, 300 users and some crazy score and passed calculations will have
    // 10 time performance differences)
    cachedScoreEvals.clear();
    for (AssessmentEntry entry : entries) {
        String nodeIdent = entry.getSubIdent();
        CourseNode courseNode = userCourseEnvironment.getCourseEnvironment().getRunStructure().getNode(nodeIdent);
        if (courseNode instanceof AssessableCourseNode) {
            AssessableCourseNode acn = (AssessableCourseNode) courseNode;
            AssessmentEvaluation se = AssessmentEvaluation.toAssessmentEvalutation(entry, acn);
            cachedScoreEvals.put(acn, se);
        }
    }
    // true=depth first
    TreeVisitor tv = new TreeVisitor(visitor, root, true);
    tv.visitAll();
    return visitor.hasChanges();
}
Also used : TreeVisitor(org.olat.core.util.tree.TreeVisitor) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) Identity(org.olat.core.id.Identity) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

Example 69 with AssessableCourseNode

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

the class ScoreRuleEditor method searchScoreableNodes.

private void searchScoreableNodes(CourseNode courseNode, List<CourseNode> nodes) {
    if (courseNode instanceof AssessableCourseNode) {
        AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
        if (assessableCourseNode.hasScoreConfigured()) {
            nodes.add(courseNode);
        }
    }
    for (int i = 0; i < courseNode.getChildCount(); i++) {
        CourseNode child = (CourseNode) courseNode.getChildAt(i);
        searchScoreableNodes(child, nodes);
    }
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode)

Example 70 with AssessableCourseNode

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

the class IdentityAssessmentOverviewController 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();
            AssessmentNodeData nodeData = tableModel.getObject(se.getIndex());
            if (CMD_SELECT_NODE.equals(cmd)) {
                CourseNode node = runStructure.getNode(nodeData.getIdent());
                selectedCourseNode = (AssessableCourseNode) node;
                fireEvent(ureq, EVENT_NODE_SELECTED);
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) AssessmentNodeData(org.olat.course.assessment.model.AssessmentNodeData)

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