Search in sources :

Example 6 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

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)

Example 7 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class AssessmentForm method reloadData.

/**
 * Reload the data in the controller
 * @param updateScoreAccounting Force a recalculation of the whole scoring in the course for the assessed user.
 */
public void reloadData() {
    ScoreAccounting scoreAccounting = assessedUserCourseEnv.getScoreAccounting();
    scoreAccounting.evaluateAll(true);
    ScoreEvaluation scoreEval = scoreAccounting.evalCourseNode(assessableCourseNode);
    if (scoreEval == null)
        scoreEval = new ScoreEvaluation(null, null);
    if (hasAttempts) {
        attemptsValue = assessableCourseNode.getUserAttempts(assessedUserCourseEnv);
        attempts.setIntValue(attemptsValue == null ? 0 : attemptsValue.intValue());
    }
    if (hasScore) {
        scoreValue = scoreEval.getScore();
        if (scoreValue != null) {
            score.setValue(AssessmentHelper.getRoundedScore(scoreValue));
        }
    }
    if (hasPassed) {
        Boolean passedValue = scoreEval.getPassed();
        passed.select(passedValue == null ? "undefined" : passedValue.toString(), true);
        passed.setEnabled(cut == null);
        // force the dirty
        passed.getComponent().setDirty(true);
    }
    if (hasComment) {
        userCommentValue = assessableCourseNode.getUserUserComment(assessedUserCourseEnv);
        userComment.setValue(userCommentValue);
    }
    reloadAssessmentDocs();
    updateStatus(scoreEval);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) ScoreAccounting(org.olat.course.run.scoring.ScoreAccounting)

Example 8 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class AbstractToolsController method doSetVisibility.

private void doSetVisibility(UserRequest ureq, boolean visible) {
    if (scoreEval != null) {
        ScoreEvaluation doneEval = new ScoreEvaluation(scoreEval.getScore(), scoreEval.getPassed(), AssessmentEntryStatus.done, visible, scoreEval.getFullyAssessed(), scoreEval.getCurrentRunCompletion(), scoreEval.getCurrentRunStatus(), scoreEval.getAssessmentID());
        courseNode.updateUserScoreEvaluation(doneEval, assessedUserCourseEnv, getIdentity(), false, Role.coach);
    }
    fireEvent(ureq, Event.CHANGED_EVENT);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation)

Example 9 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class ConvertToGTACourseNode method convertAssessmentDatas.

private void convertAssessmentDatas(TaskList taskList, TACourseNode sourceNode, GTACourseNode gtaNode, ICourse course) {
    CourseEnvironment courseEnv = course.getCourseEnvironment();
    CoursePropertyManager propertyMgr = courseEnv.getCoursePropertyManager();
    Map<Long, AssessmentEntry> datas = new HashMap<>();
    List<AssessmentEntry> properties = courseEnv.getAssessmentManager().getAssessmentEntries(sourceNode);
    for (AssessmentEntry property : properties) {
        Identity identity = property.getIdentity();
        datas.put(identity.getKey(), property);
    }
    properties = null;
    DBFactory.getInstance().getCurrentEntityManager().clear();
    AssessmentManager assessmentMgr = courseEnv.getAssessmentManager();
    for (AssessmentEntry assessmentData : datas.values()) {
        Identity assessedIdentity = securityManager.loadIdentityByKey(assessmentData.getIdentity().getKey());
        if (assessmentData.getPassed() != null || assessmentData.getScore() != null) {
            UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
            Float score = assessmentData.getScore() == null ? null : assessmentData.getScore().floatValue();
            ScoreEvaluation scoreEval = new ScoreEvaluation(score, assessmentData.getPassed());
            assessmentMgr.saveScoreEvaluation(gtaNode, null, assessedIdentity, scoreEval, userCourseEnv, false, Role.auto);
            // set graded
            Task task = gtaManager.getTask(assessedIdentity, taskList);
            if (task == null) {
                gtaManager.createTask(null, taskList, TaskProcess.graded, null, assessedIdentity, gtaNode);
            } else {
                gtaManager.updateTask(task, TaskProcess.graded, gtaNode, Role.auto);
            }
        }
        if (assessmentData.getAttempts() != null) {
            assessmentMgr.saveNodeAttempts(gtaNode, null, assessedIdentity, assessmentData.getAttempts().intValue(), Role.auto);
        }
        if (StringHelper.containsNonWhitespace(assessmentData.getCoachComment())) {
            assessmentMgr.saveNodeCoachComment(gtaNode, assessedIdentity, assessmentData.getCoachComment());
        }
        if (StringHelper.containsNonWhitespace(assessmentData.getComment())) {
            assessmentMgr.saveNodeComment(gtaNode, null, assessedIdentity, assessmentData.getComment());
        }
    }
    DBFactory.getInstance().getCurrentEntityManager().clear();
    // copy log entries
    List<Property> logEntries = propertyMgr.listCourseNodeProperties(sourceNode, null, null, UserNodeAuditManager.LOG_IDENTIFYER);
    for (Property logEntry : logEntries) {
        String logText = logEntry.getTextValue();
        Identity identity = securityManager.loadIdentityByKey(logEntry.getIdentity().getKey());
        Property targetProp = propertyMgr.findCourseNodeProperty(gtaNode, identity, null, UserNodeAuditManager.LOG_IDENTIFYER);
        if (targetProp == null) {
            targetProp = propertyMgr.createCourseNodePropertyInstance(gtaNode, identity, null, UserNodeAuditManager.LOG_IDENTIFYER, null, null, null, logText);
        } else {
            targetProp.setTextValue(logText);
        }
        propertyMgr.saveProperty(targetProp);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) Task(org.olat.course.nodes.gta.Task) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) HashMap(java.util.HashMap) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessmentManager(org.olat.course.assessment.AssessmentManager) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) Identity(org.olat.core.id.Identity) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 10 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation in project OpenOLAT by OpenOLAT.

the class QTI12PullTestsToolController method retrieveTest.

private void retrieveTest(Identity assessedIdentity, ICourse course) {
    ModuleConfiguration modConfig = courseNode.getModuleConfiguration();
    String resourcePathInfo = courseEnv.getCourseResourceableId() + File.separator + courseNode.getIdent();
    AssessmentInstance ai = AssessmentFactory.createAssessmentInstance(assessedIdentity, "", modConfig, false, courseEnv.getCourseResourceableId(), courseNode.getIdent(), resourcePathInfo, null);
    // close the test
    ai.stop();
    // persist the results
    iqm.persistResults(ai);
    // reporting
    Document docResReporting = iqm.getResultsReporting(ai, assessedIdentity, I18nModule.getDefaultLocale());
    FilePersister.createResultsReporting(docResReporting, assessedIdentity, ai.getFormattedType(), ai.getAssessID());
    // olat results
    AssessmentContext ac = ai.getAssessmentContext();
    Float score = new Float(ac.getScore());
    Boolean passed = new Boolean(ac.isPassed());
    ScoreEvaluation sceval = new ScoreEvaluation(score, passed, Boolean.FALSE, new Long(ai.getAssessID()));
    UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
    courseNode.updateUserScoreEvaluation(sceval, userCourseEnv, assessedIdentity, true, Role.coach);
    // cleanup
    ai.cleanUp();
}
Also used : AssessmentContext(org.olat.ims.qti.container.AssessmentContext) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) ModuleConfiguration(org.olat.modules.ModuleConfiguration) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) AssessmentInstance(org.olat.ims.qti.process.AssessmentInstance) Document(org.dom4j.Document)

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