Search in sources :

Example 16 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class MSCourseNode method updateUserScoreEvaluation.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#updateUserScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.core.id.Identity)
 */
@Override
public void updateUserScoreEvaluation(ScoreEvaluation scoreEvaluation, UserCourseEnvironment userCourseEnvironment, Identity coachingIdentity, boolean incrementAttempts, Role by) {
    AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager();
    Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    am.saveScoreEvaluation(this, coachingIdentity, mySelf, new ScoreEvaluation(scoreEvaluation), userCourseEnvironment, incrementAttempts, by);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 17 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class ProjectBrokerCourseNode method updateUserScoreEvaluation.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#updateUserScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.core.id.Identity)
 */
@Override
public void updateUserScoreEvaluation(ScoreEvaluation scoreEvaluation, UserCourseEnvironment userCourseEnvironment, Identity coachingIdentity, boolean incrementAttempts, Role by) {
    AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager();
    Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    am.saveScoreEvaluation(this, coachingIdentity, mySelf, new ScoreEvaluation(scoreEvaluation), userCourseEnvironment, incrementAttempts, by);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 18 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class ScormCourseNode method updateUserScoreEvaluation.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#updateUserScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.core.id.Identity)
 */
@Override
public void updateUserScoreEvaluation(ScoreEvaluation scoreEvaluation, UserCourseEnvironment userCourseEnvironment, Identity coachingIdentity, boolean incrementAttempts, Role by) {
    AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager();
    Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    am.saveScoreEvaluation(this, coachingIdentity, mySelf, new ScoreEvaluation(scoreEvaluation), userCourseEnvironment, incrementAttempts, by);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 19 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class GroupAssessmentController method applyChangesForTheWholeGroup.

private void applyChangesForTheWholeGroup(List<AssessmentRow> rows, boolean setAsDone, boolean userVisible) {
    ICourse course = CourseFactory.loadCourse(courseEntry);
    Float score = null;
    if (withScore) {
        String scoreValue = groupScoreEl.getValue();
        if (StringHelper.containsNonWhitespace(scoreValue)) {
            score = Float.parseFloat(scoreValue);
        }
    }
    Boolean passed = null;
    if (withPassed) {
        if (cutValue == null) {
            passed = groupPassedEl.isSelected(0);
        } else if (score != null) {
            passed = (score.floatValue() >= cutValue.floatValue()) ? Boolean.TRUE : Boolean.FALSE;
        }
    }
    for (AssessmentRow row : rows) {
        UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
        ScoreEvaluation newScoreEval;
        if (setAsDone) {
            newScoreEval = new ScoreEvaluation(score, passed, AssessmentEntryStatus.done, userVisible, true, null, null, null);
        } else {
            newScoreEval = new ScoreEvaluation(score, passed, null, userVisible, null, null, null, null);
        }
        gtaNode.updateUserScoreEvaluation(newScoreEval, userCourseEnv, getIdentity(), false, Role.coach);
    }
    if (withComment) {
        String comment = groupCommentEl.getValue();
        if (StringHelper.containsNonWhitespace(comment)) {
            for (AssessmentRow row : rows) {
                UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
                gtaNode.updateUserUserComment(comment, userCourseEnv, getIdentity());
            }
        }
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse)

Example 20 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class GroupAssessmentController method loadModel.

/**
 * @return True if all results are the same
 */
private ModelInfos loadModel() {
    // load participants, load datas
    ICourse course = CourseFactory.loadCourse(courseEntry);
    List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
    Map<Identity, AssessmentEntry> identityToEntryMap = new HashMap<>();
    List<AssessmentEntry> entries = course.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(assessedGroup, gtaNode);
    for (AssessmentEntry entry : entries) {
        identityToEntryMap.put(entry.getIdentity(), entry);
    }
    int count = 0;
    boolean same = true;
    StringBuilder duplicateWarning = new StringBuilder();
    Float scoreRef = null;
    Boolean passedRef = null;
    String commentRef = null;
    Boolean userVisibleRef = null;
    List<AssessmentRow> rows = new ArrayList<>(identities.size());
    for (Identity identity : identities) {
        AssessmentEntry entry = identityToEntryMap.get(identity);
        ScoreEvaluation scoreEval = null;
        if (withScore || withPassed) {
            scoreEval = gtaNode.getUserScoreEvaluation(entry);
            if (scoreEval == null) {
                scoreEval = ScoreEvaluation.EMPTY_EVALUATION;
            }
        }
        String comment = null;
        if (withComment && entry != null) {
            comment = entry.getComment();
        }
        boolean duplicate = duplicateMemberKeys.contains(identity.getKey());
        if (duplicate) {
            if (duplicateWarning.length() > 0)
                duplicateWarning.append(", ");
            duplicateWarning.append(StringHelper.escapeHtml(userManager.getUserDisplayName(identity)));
        }
        AssessmentRow row = new AssessmentRow(identity, duplicate);
        rows.add(row);
        if (withScore) {
            Float score = scoreEval.getScore();
            String pointVal = AssessmentHelper.getRoundedScore(score);
            TextElement pointEl = uifactory.addTextElement("point" + count, null, 5, pointVal, flc);
            pointEl.setDisplaySize(5);
            row.setScoreEl(pointEl);
            if (count == 0) {
                scoreRef = score;
            } else if (!same(scoreRef, score)) {
                same = false;
            }
        }
        if (withPassed && cutValue == null) {
            Boolean passed = scoreEval.getPassed();
            MultipleSelectionElement passedEl = uifactory.addCheckboxesHorizontal("check" + count, null, flc, onKeys, onValues);
            if (passed != null && passed.booleanValue()) {
                passedEl.select(onKeys[0], passed.booleanValue());
            }
            row.setPassedEl(passedEl);
            if (count == 0) {
                passedRef = passed;
            } else if (!same(passedRef, passed)) {
                same = false;
            }
        }
        if (withComment) {
            FormLink commentLink = uifactory.addFormLink("comment-" + CodeHelper.getRAMUniqueID(), "comment", "comment", null, flc, Link.LINK);
            if (StringHelper.containsNonWhitespace(comment)) {
                commentLink.setIconLeftCSS("o_icon o_icon_comments");
            } else {
                commentLink.setIconLeftCSS("o_icon o_icon_comments_none");
            }
            commentLink.setUserObject(row);
            row.setComment(comment);
            row.setCommentEditLink(commentLink);
            if (count == 0) {
                commentRef = comment;
            } else if (!same(commentRef, comment)) {
                same = false;
            }
        }
        if (withScore || withPassed || withPassed) {
            Boolean userVisible = scoreEval.getUserVisible();
            if (userVisible == null) {
                userVisible = Boolean.TRUE;
            }
            if (count == 0) {
                userVisibleRef = userVisible;
            } else if (!same(userVisibleRef, userVisible)) {
                same = false;
            }
        }
        count++;
    }
    model.setObjects(rows);
    table.reset();
    return new ModelInfos(same, scoreRef, passedRef, commentRef, userVisibleRef, duplicateWarning.toString());
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) Identity(org.olat.core.id.Identity)

Aggregations

ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)130 Identity (org.olat.core.id.Identity)54 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)52 ICourse (org.olat.course.ICourse)40 AssessmentManager (org.olat.course.assessment.AssessmentManager)34 CourseNode (org.olat.course.nodes.CourseNode)28 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)26 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)22 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)22 RepositoryEntry (org.olat.repository.RepositoryEntry)20 ArrayList (java.util.ArrayList)16 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)14 ModuleConfiguration (org.olat.modules.ModuleConfiguration)14 ScoreAccounting (org.olat.course.run.scoring.ScoreAccounting)12 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)12 List (java.util.List)10 Test (org.junit.Test)10 AssessmentEntryStatus (org.olat.modules.assessment.model.AssessmentEntryStatus)10 BigDecimal (java.math.BigDecimal)8 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)8