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);
}
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);
}
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);
}
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());
}
}
}
}
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());
}
Aggregations