use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class CourseNodeOutcomeMapper method doReadResult.
@Override
protected String doReadResult(IMSPOXRequest pox) {
ICourse course = CourseFactory.loadCourse(courseOresId);
CourseNode node = course.getRunStructure().getNode(courseNodeId);
if (node instanceof BasicLTICourseNode) {
BasicLTICourseNode ltiNode = (BasicLTICourseNode) node;
UserCourseEnvironment userCourseEnv = getUserCourseEnvironment(course);
ScoreEvaluation eval = ltiNode.getUserScoreEvaluation(userCourseEnv);
String score = "";
if (eval != null && eval.getScore() != null) {
float scaledScore = eval.getScore();
if (scaledScore > 0.0f) {
float scale = getScalingFactor(ltiNode);
scaledScore = scaledScore / scale;
}
score = Float.toString(scaledScore);
}
Map<String, Object> theMap = new TreeMap<String, Object>();
theMap.put("/readResultResponse/result/sourcedId", getSourcedId());
theMap.put("/readResultResponse/result/resultScore/textString", score);
theMap.put("/readResultResponse/result/resultScore/language", "en");
String theXml = XMLMap.getXMLFragment(theMap, true);
return pox.getResponseSuccess("Result read", theXml);
}
return super.doReadResult(pox);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class GTACourseNode method updateUserScoreEvaluation.
@Override
public void updateUserScoreEvaluation(ScoreEvaluation scoreEvaluation, UserCourseEnvironment userCourseEnv, Identity coachingIdentity, boolean incrementAttempts, Role by) {
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
Identity assessedIdentity = userCourseEnv.getIdentityEnvironment().getIdentity();
am.saveScoreEvaluation(this, coachingIdentity, assessedIdentity, new ScoreEvaluation(scoreEvaluation), userCourseEnv, incrementAttempts, by);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class QTI21AssessmentDetailsController method doUpdateCourseNode.
private void doUpdateCourseNode(AssessmentTestSession session, AssessmentTest assessmentTest) {
Double cutValue = QtiNodesExtractor.extractCutValue(assessmentTest);
ScoreEvaluation scoreEval = courseNode.getUserScoreEvaluation(assessedUserCourseEnv);
BigDecimal finalScore = session.getFinalScore();
Float score = finalScore == null ? null : finalScore.floatValue();
Boolean passed = scoreEval.getPassed();
if (session.getManualScore() != null && finalScore != null && cutValue != null) {
boolean calculated = finalScore.compareTo(BigDecimal.valueOf(cutValue.doubleValue())) >= 0;
passed = Boolean.valueOf(calculated);
}
ScoreEvaluation manualScoreEval = new ScoreEvaluation(score, passed, scoreEval.getAssessmentStatus(), null, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), session.getKey());
courseNode.updateUserScoreEvaluation(manualScoreEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class IdentityListCourseNodeController method doSetDone.
private void doSetDone(UserRequest ureq) {
Set<Integer> selections = tableEl.getMultiSelectedIndex();
List<AssessedIdentityElementRow> rows = new ArrayList<>(selections.size());
for (Integer i : selections) {
AssessedIdentityElementRow row = usersTableModel.getObject(i.intValue());
if (row != null && row.getAssessmentStatus() != AssessmentEntryStatus.done) {
rows.add(row);
}
}
if (rows == null || rows.isEmpty()) {
showWarning("warning.bulk.done");
} else if (courseNode instanceof AssessableCourseNode) {
ICourse course = CourseFactory.loadCourse(courseEntry);
AssessableCourseNode assessableCourseNode = (AssessableCourseNode) courseNode;
for (AssessedIdentityElementRow row : rows) {
Identity assessedIdentity = securityManager.loadIdentityByKey(row.getIdentityKey());
Roles roles = securityManager.getRoles(assessedIdentity);
IdentityEnvironment identityEnv = new IdentityEnvironment(assessedIdentity, roles);
UserCourseEnvironment assessedUserCourseEnv = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment(), coachCourseEnv.isCourseReadOnly());
assessedUserCourseEnv.getScoreAccounting().evaluateAll();
ScoreEvaluation scoreEval = assessableCourseNode.getUserScoreEvaluation(assessedUserCourseEnv);
ScoreEvaluation doneEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.done, null, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
assessableCourseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
}
loadModel(ureq);
}
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class AssessmentForm method doReopen.
private void doReopen() {
ScoreEvaluation scoreEval = assessedUserCourseEnv.getScoreAccounting().evalCourseNode(assessableCourseNode);
if (scoreEval != null) {
ScoreEvaluation reopenedEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.inReview, scoreEval.getUserVisible(), scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
assessableCourseNode.updateUserScoreEvaluation(reopenedEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
updateStatus(reopenedEval);
}
}
Aggregations