Search in sources :

Example 66 with ScoreEvaluation

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);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment)

Example 67 with ScoreEvaluation

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);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 68 with ScoreEvaluation

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);
}
Also used : CheckboxManager(org.olat.course.nodes.cl.CheckboxManager) CheckboxList(org.olat.course.nodes.cl.model.CheckboxList) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) ModuleConfiguration(org.olat.modules.ModuleConfiguration) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentManager(org.olat.course.assessment.AssessmentManager)

Example 69 with ScoreEvaluation

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);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) ModuleConfiguration(org.olat.modules.ModuleConfiguration) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessmentManager(org.olat.course.assessment.AssessmentManager) IdentityEnvironment(org.olat.core.id.IdentityEnvironment)

Example 70 with ScoreEvaluation

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);
}
Also used : CheckboxManager(org.olat.course.nodes.cl.CheckboxManager) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentManager(org.olat.course.assessment.AssessmentManager)

Aggregations

ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)130 Identity (org.olat.core.id.Identity)54 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)52 ICourse (org.olat.course.ICourse)40 AssessmentManager (org.olat.course.assessment.AssessmentManager)34 CourseNode (org.olat.course.nodes.CourseNode)28 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)26 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)22 UserCourseEnvironmentImpl (org.olat.course.run.userview.UserCourseEnvironmentImpl)22 RepositoryEntry (org.olat.repository.RepositoryEntry)20 ArrayList (java.util.ArrayList)16 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)14 ModuleConfiguration (org.olat.modules.ModuleConfiguration)14 ScoreAccounting (org.olat.course.run.scoring.ScoreAccounting)12 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)12 List (java.util.List)10 Test (org.junit.Test)10 AssessmentEntryStatus (org.olat.modules.assessment.model.AssessmentEntryStatus)10 BigDecimal (java.math.BigDecimal)8 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)8