*
* @param coachIdentity The identity of the coach who changes the users values
* (will be written to the user node log)
*/
protected void doUpdateAssessmentData(Identity coachIdentity) {
UserCourseEnvironment userCourseEnvironment = assessedIdentityWrapper.getUserCourseEnvironment();
ScoreEvaluation scoreEval = null;
Float newScore = null;
Boolean newPassed = null;
//String userName = userCourseEnvironment.getIdentityEnvironment().getIdentity().getName();
if (assessmentForm.isHasAttempts() && assessmentForm.isAttemptsDirty()) {
this.courseNode.updateUserAttempts(new Integer(assessmentForm.getAttempts()), userCourseEnvironment, coachIdentity);
}
if (assessmentForm.isHasScore() && assessmentForm.isScoreDirty()) {
newScore = new Float(assessmentForm.getScore());
// Update properties in db later... see
// courseNode.updateUserSocreAndPassed...
}
if (assessmentForm.isHasPassed()) {
if (assessmentForm.getCut() != null && StringHelper.containsNonWhitespace(assessmentForm.getScore())) {
newPassed = Float.parseFloat(assessmentForm.getScore()) >= assessmentForm.getCut().floatValue()
? Boolean.TRUE : Boolean.FALSE;
} else {
//"passed" info was changed or not
String selectedKeyString = assessmentForm.getPassed().getSelectedKey();
if("true".equalsIgnoreCase(selectedKeyString) || "false".equalsIgnoreCase(selectedKeyString)) {
newPassed = Boolean.valueOf(selectedKeyString);
}
else {
// "undefined" was choosen
newPassed = null;
}
}
}
// Update score,passed properties in db
scoreEval = new ScoreEvaluation(newScore, newPassed);
this.courseNode.updateUserScoreEvaluation(scoreEval, userCourseEnvironment, coachIdentity, false);
if (assessmentForm.isHasComment() && assessmentForm.isUserCommentDirty()) {
String newComment = assessmentForm.getUserComment().getValue();
// Update properties in db
courseNode.updateUserUserComment(newComment, userCourseEnvironment, coachIdentity);
}
if (assessmentForm.isCoachCommentDirty()) {
String newCoachComment = assessmentForm.getCoachComment().getValue();
// Update properties in db
this.courseNode.updateUserCoachComment(newCoachComment, userCourseEnvironment);
}
// Refresh score view
userCourseEnvironment.getScoreAccounting().scoreInfoChanged(this.courseNode, scoreEval);
}