use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class AssessedIdentityCertificatesController method doGenerateCertificate.
private void doGenerateCertificate(UserRequest ureq) {
ICourse course = CourseFactory.loadCourse(resource);
CourseNode rootNode = course.getRunStructure().getRootNode();
Identity assessedIdentity = assessedUserCourseEnv.getIdentityEnvironment().getIdentity();
ScoreEvaluation scoreEval = assessedUserCourseEnv.getScoreAccounting().getScoreEvaluation(rootNode);
RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
CertificateTemplate template = null;
Long templateKey = course.getCourseConfig().getCertificateTemplate();
if (templateKey != null) {
template = certificatesManager.getTemplateById(templateKey);
}
Float score = scoreEval == null ? null : scoreEval.getScore();
Boolean passed = scoreEval == null ? null : scoreEval.getPassed();
CertificateInfos certificateInfos = new CertificateInfos(assessedIdentity, score, passed);
certificatesManager.generateCertificate(certificateInfos, courseEntry, template, true);
loadList();
showInfo("msg.certificate.pending");
fireEvent(ureq, Event.CHANGED_EVENT);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class AbstractToolsController method doSetVisibility.
private void doSetVisibility(UserRequest ureq, boolean visible) {
if (scoreEval != null) {
ScoreEvaluation doneEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.done, visible, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
courseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
}
fireEvent(ureq, Event.CHANGED_EVENT);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
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 klemens.
the class GroupAssessmentController method applyChangesForEveryMemberGroup.
private void applyChangesForEveryMemberGroup(List<AssessmentRow> rows, boolean setAsDone, boolean userVisible) {
ICourse course = CourseFactory.loadCourse(courseEntry);
for (AssessmentRow row : rows) {
UserCourseEnvironment userCourseEnv = row.getUserCourseEnvironment(course);
Float score = null;
if (withScore) {
String value = row.getScoreEl().getValue();
if (StringHelper.containsNonWhitespace(value)) {
score = Float.parseFloat(value);
}
}
Boolean passed = null;
if (withPassed) {
if (cutValue == null) {
passed = row.getPassedEl().isSelected(0);
} else if (score != null) {
passed = (score.floatValue() >= cutValue.floatValue()) ? Boolean.TRUE : Boolean.FALSE;
}
}
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 = row.getComment();
if (StringHelper.containsNonWhitespace(comment)) {
gtaNode.updateUserUserComment(comment, userCourseEnv, getIdentity());
}
}
}
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class IQRunController method exposeUserSelfTestDataToVC.
/**
* Provides the self test score and results, if any, to the velocity container.
* @param ureq
*/
private void exposeUserSelfTestDataToVC(UserRequest ureq) {
if (!(courseNode instanceof SelfAssessableCourseNode)) {
throw new AssertException("exposeUserSelfTestDataToVC can only be called for selftest nodes, not for test or questionnaire");
}
// config : show score info
Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
if (enableScoreInfoObject != null) {
myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
} else {
myContent.contextPut("enableScoreInfo", Boolean.TRUE);
}
SelfAssessableCourseNode acn = (SelfAssessableCourseNode) courseNode;
ScoreEvaluation scoreEval = acn.getUserScoreEvaluation(userCourseEnv);
if (scoreEval != null) {
myContent.contextPut("hasResults", Boolean.TRUE);
myContent.contextPut("resultsVisible", Boolean.TRUE);
myContent.contextPut("score", AssessmentHelper.getRoundedScore(scoreEval.getScore()));
myContent.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
myContent.contextPut("passed", scoreEval.getPassed());
// at least one attempt
myContent.contextPut("attempts", new Integer(1));
exposeResults(ureq);
}
}
Aggregations