use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class ConfirmReopenController method formOK.
@Override
protected void formOK(UserRequest ureq) {
testSession = qtiService.reopenAssessmentTestSession(testSession, getIdentity());
if (testSession == null) {
showWarning("");
} else {
UserCourseEnvironment assessedUserCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(testSession.getIdentity(), courseEnv);
ScoreEvaluation scoreEval = courseNode.getUserScoreEvaluation(assessedUserCourseEnv);
ScoreEvaluation reopenedScoreEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.inProgress, scoreEval.getUserVisible(), scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), AssessmentRunStatus.running, testSession.getKey());
courseNode.updateUserScoreEvaluation(reopenedScoreEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
ThreadLocalUserActivityLogger.log(QTI21LoggingAction.QTI_REOPEN_IN_COURSE, getClass());
}
fireEvent(ureq, Event.DONE_EVENT);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class BasicLTICourseNode method updateUserScoreEvaluation.
@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 klemens.
the class CheckListCourseNode method doUpdateAssessmentBySum.
private void doUpdateAssessmentBySum(Identity identity, UserCourseEnvironment assessedUserCourseEnv, Identity assessedIdentity, Role by) {
OLATResourceable courseOres = OresHelper.createOLATResourceableInstance("CourseModule", assessedUserCourseEnv.getCourseEnvironment().getCourseResourceableId());
ModuleConfiguration config = getModuleConfiguration();
CheckboxManager checkboxManager = CoreSpringFactory.getImpl(CheckboxManager.class);
int checkedBox = checkboxManager.countChecked(assessedIdentity, courseOres, getIdent());
CheckboxList checkboxList = (CheckboxList) config.get(CONFIG_KEY_CHECKBOX);
Integer cut = (Integer) config.get(CheckListCourseNode.CONFIG_KEY_PASSED_SUM_CUTVALUE);
int minNumOfCheckbox = cut == null ? checkboxList.getNumOfCheckbox() : cut.intValue();
boolean passed = checkedBox >= minNumOfCheckbox;
Float score = null;
if (passed) {
Boolean scoreGrantedBool = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
if (scoreGrantedBool != null && scoreGrantedBool.booleanValue()) {
score = checkboxManager.calculateScore(assessedIdentity, courseOres, getIdent());
Float maxScore = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
if (maxScore != null && maxScore.floatValue() < score) {
score = maxScore.floatValue();
}
}
}
ScoreEvaluation sceval = new ScoreEvaluation(score, new Boolean(passed));
AssessmentManager am = assessedUserCourseEnv.getCourseEnvironment().getAssessmentManager();
am.saveScoreEvaluation(this, identity, assessedIdentity, sceval, assessedUserCourseEnv, false, by);
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class CheckListCourseNode method updateScorePassedOnPublish.
private void updateScorePassedOnPublish(Identity assessedIdentity, Identity coachIdentity, CheckboxManager checkboxManager, ICourse course) {
AssessmentManager am = course.getCourseEnvironment().getAssessmentManager();
Float currentScore = am.getNodeScore(this, assessedIdentity);
Boolean currentPassed = am.getNodePassed(this, assessedIdentity);
Float updatedScore = null;
Boolean updatedPassed = null;
ModuleConfiguration config = getModuleConfiguration();
Boolean scoreGrantedBool = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
if (scoreGrantedBool != null && scoreGrantedBool.booleanValue()) {
updatedScore = checkboxManager.calculateScore(assessedIdentity, course, getIdent());
} else {
updatedScore = null;
}
Boolean passedBool = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD);
if (passedBool != null && passedBool.booleanValue()) {
Float cutValue = (Float) config.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE);
Boolean sumCheckbox = (Boolean) config.get(CheckListCourseNode.CONFIG_KEY_PASSED_SUM_CHECKBOX);
if (sumCheckbox != null && sumCheckbox.booleanValue()) {
Integer minValue = (Integer) config.get(CheckListCourseNode.CONFIG_KEY_PASSED_SUM_CUTVALUE);
int checkedBox = checkboxManager.countChecked(assessedIdentity, course, getIdent());
if (minValue != null && minValue.intValue() <= checkedBox) {
updatedPassed = Boolean.TRUE;
} else {
updatedPassed = Boolean.FALSE;
}
} else if (cutValue != null) {
if (updatedScore == null) {
updatedScore = checkboxManager.calculateScore(assessedIdentity, course, getIdent());
}
if (updatedScore != null && cutValue.floatValue() <= updatedScore.floatValue()) {
updatedPassed = Boolean.TRUE;
} else {
updatedPassed = Boolean.FALSE;
}
}
} else {
updatedPassed = null;
}
boolean needUpdate = false;
Boolean manualCorrection = (Boolean) config.get(CheckListCourseNode.CONFIG_KEY_PASSED_MANUAL_CORRECTION);
if (manualCorrection == null || !manualCorrection.booleanValue()) {
// update passed
if ((currentPassed == null && updatedPassed != null && updatedScore != null && updatedScore.floatValue() > 0f) || (currentPassed != null && updatedPassed == null) || (currentPassed != null && !currentPassed.equals(updatedPassed))) {
needUpdate = true;
}
}
if ((currentScore == null && updatedScore != null && updatedScore.floatValue() > 0f) || (currentScore != null && updatedScore == null) || (currentScore != null && !currentScore.equals(updatedScore))) {
needUpdate = true;
}
if (needUpdate) {
ScoreEvaluation scoreEval = new ScoreEvaluation(updatedScore, updatedPassed);
IdentityEnvironment identityEnv = new IdentityEnvironment(assessedIdentity, null);
UserCourseEnvironment uce = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment());
am.saveScoreEvaluation(this, coachIdentity, assessedIdentity, scoreEval, uce, false, Role.coach);
}
}
use of org.olat.course.run.scoring.ScoreEvaluation in project openolat by klemens.
the class CheckListCourseNode method doUpdateScoreOnly.
private void doUpdateScoreOnly(Float maxScore, Identity identity, UserCourseEnvironment assessedUserCourseEnv, Identity assessedIdentity, Role by) {
OLATResourceable courseOres = OresHelper.createOLATResourceableInstance("CourseModule", assessedUserCourseEnv.getCourseEnvironment().getCourseResourceableId());
CheckboxManager checkboxManager = CoreSpringFactory.getImpl(CheckboxManager.class);
float score = checkboxManager.calculateScore(assessedIdentity, courseOres, getIdent());
if (maxScore != null && maxScore.floatValue() < score) {
score = maxScore.floatValue();
}
AssessmentManager am = assessedUserCourseEnv.getCourseEnvironment().getAssessmentManager();
ScoreEvaluation currentEval = getUserScoreEvaluation(am.getAssessmentEntry(this, assessedIdentity));
ScoreEvaluation sceval = new ScoreEvaluation(new Float(score), currentEval.getPassed());
am.saveScoreEvaluation(this, identity, assessedIdentity, sceval, assessedUserCourseEnv, false, by);
}
Aggregations