Search in sources :

Example 56 with ScoreEvaluation

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);
}
Also used : BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) BasicLTICourseNode(org.olat.course.nodes.BasicLTICourseNode) TreeMap(java.util.TreeMap)

Example 57 with ScoreEvaluation

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

Example 58 with ScoreEvaluation

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

Example 59 with ScoreEvaluation

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);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessedIdentityElementRow(org.olat.modules.assessment.ui.AssessedIdentityElementRow) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) Roles(org.olat.core.id.Roles) CalculatedAssessableCourseNode(org.olat.course.nodes.CalculatedAssessableCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) UserCourseEnvironmentImpl(org.olat.course.run.userview.UserCourseEnvironmentImpl) Identity(org.olat.core.id.Identity) IdentityEnvironment(org.olat.core.id.IdentityEnvironment)

Example 60 with ScoreEvaluation

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

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