Search in sources :

Example 46 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project OpenOLAT by OpenOLAT.

the class CheckListCourseNode method getIndividualAssessmentDocuments.

@Override
public List<File> getIndividualAssessmentDocuments(UserCourseEnvironment userCourseEnvironment) {
    AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager();
    Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    return am.getIndividualAssessmentDocuments(this, mySelf);
}
Also used : AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 47 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project OpenOLAT by OpenOLAT.

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 48 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project OpenOLAT by OpenOLAT.

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)

Example 49 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project OpenOLAT by OpenOLAT.

the class IQSELFCourseNode method incrementUserAttempts.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#incrementUserAttempts(org.olat.course.run.userview.UserCourseEnvironment)
 */
@Override
public void incrementUserAttempts(UserCourseEnvironment userCourseEnvironment, Role by) {
    AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager();
    Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    am.incrementNodeAttempts(this, mySelf, userCourseEnvironment, by);
}
Also used : AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 50 with AssessmentManager

use of org.olat.course.assessment.AssessmentManager in project OpenOLAT by OpenOLAT.

the class IQSELFCourseNode method getUserScoreEvaluation.

/**
 * @see org.olat.course.nodes.SelfAssessableCourseNode#getUserScoreEvaluation(org.olat.course.run.userview.UserCourseEnvironment)
 */
@Override
public ScoreEvaluation getUserScoreEvaluation(final UserCourseEnvironment userCourseEnv) {
    // read score from properties save score, passed and attempts information
    ScoreEvaluation scoreEvaluation = null;
    RepositoryEntry referencedRepositoryEntry = getReferencedRepositoryEntry();
    if (referencedRepositoryEntry != null && OnyxModule.isOnyxTest(getReferencedRepositoryEntry().getOlatResource())) {
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        Identity mySelf = userCourseEnv.getIdentityEnvironment().getIdentity();
        Boolean passed = am.getNodePassed(this, mySelf);
        Float score = am.getNodeScore(this, mySelf);
        Long assessmentID = am.getAssessmentID(this, mySelf);
        // <OLATCE-374>
        Boolean fullyAssessed = am.getNodeFullyAssessed(this, mySelf);
        scoreEvaluation = new ScoreEvaluation(score, passed, fullyAssessed, assessmentID);
    // </OLATCE-374>
    } else if (referencedRepositoryEntry != null && ImsQTI21Resource.TYPE_NAME.equals(referencedRepositoryEntry.getOlatResource().getResourceableTypeName())) {
        RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        Identity assessedIdentity = userCourseEnv.getIdentityEnvironment().getIdentity();
        AssessmentTestSession testSession = CoreSpringFactory.getImpl(QTI21Service.class).getLastAssessmentTestSessions(courseEntry, getIdent(), referencedRepositoryEntry, assessedIdentity);
        if (testSession != null) {
            boolean fullyAssessed = (testSession.getFinishTime() != null || testSession.getTerminationTime() != null);
            Float score = testSession.getScore().floatValue();
            return new ScoreEvaluation(score, testSession.getPassed(), fullyAssessed, testSession.getKey());
        }
    } else {
        Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
        long olatResourceId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
        QTIResultSet qTIResultSet = CoreSpringFactory.getImpl(IQManager.class).getLastResultSet(identity, olatResourceId, this.getIdent());
        if (qTIResultSet != null) {
            Boolean passed = qTIResultSet.getIsPassed();
            Boolean fullyAssessed = qTIResultSet.getFullyAssessed();
            scoreEvaluation = new ScoreEvaluation(Float.valueOf(qTIResultSet.getScore()), passed, fullyAssessed, new Long(qTIResultSet.getAssessmentID()));
        }
    }
    return scoreEvaluation;
}
Also used : QTIResultSet(org.olat.ims.qti.QTIResultSet) AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity)

Aggregations

AssessmentManager (org.olat.course.assessment.AssessmentManager)244 Identity (org.olat.core.id.Identity)208 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)34 RepositoryEntry (org.olat.repository.RepositoryEntry)20 OLATResourceable (org.olat.core.id.OLATResourceable)14 ModuleConfiguration (org.olat.modules.ModuleConfiguration)14 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)12 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)10 Date (java.util.Date)8 Controller (org.olat.core.gui.control.Controller)8 Translator (org.olat.core.gui.translator.Translator)8 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)8 ICourse (org.olat.course.ICourse)8 File (java.io.File)6 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)6 Roles (org.olat.core.id.Roles)6 NodeEditController (org.olat.course.editor.NodeEditController)6 CourseNode (org.olat.course.nodes.CourseNode)6 CheckboxManager (org.olat.course.nodes.cl.CheckboxManager)6 CourseIQSecurityCallback (org.olat.course.nodes.iq.CourseIQSecurityCallback)6