Search in sources :

Example 36 with ScoreEvaluation

use of org.olat.course.run.scoring.ScoreEvaluation 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)

Example 37 with ScoreEvaluation

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

the class IQTESTCourseNode method pullAssessmentTestSession.

public void pullAssessmentTestSession(AssessmentTestSession session, UserCourseEnvironment assessedUserCourseenv, Identity coachingIdentity, Role by) {
    Boolean visibility;
    AssessmentEntryStatus assessmentStatus;
    if (IQEditController.CORRECTION_MANUAL.equals(getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE))) {
        assessmentStatus = AssessmentEntryStatus.inReview;
        visibility = Boolean.FALSE;
    } else {
        assessmentStatus = AssessmentEntryStatus.done;
        visibility = Boolean.TRUE;
    }
    ScoreEvaluation sceval = new ScoreEvaluation(session.getScore().floatValue(), session.getPassed(), assessmentStatus, visibility, Boolean.TRUE, 1.0d, AssessmentRunStatus.done, session.getKey());
    updateUserScoreEvaluation(sceval, assessedUserCourseenv, coachingIdentity, true, by);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus)

Example 38 with ScoreEvaluation

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

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 39 with ScoreEvaluation

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

the class ScormRunController method doStartPage.

private void doStartPage(UserRequest ureq) {
    // push title and learning objectives, only visible on intro page
    startPage.contextPut("menuTitle", scormNode.getShortTitle());
    startPage.contextPut("displayTitle", scormNode.getLongTitle());
    // Adding learning objectives
    String learningObj = scormNode.getLearningObjectives();
    if (learningObj != null) {
        Component learningObjectives = ObjectivesHelper.createLearningObjectivesComponent(learningObj, getLocale());
        startPage.put("learningObjectives", learningObjectives);
        startPage.contextPut("hasObjectives", Boolean.TRUE);
    } else {
        startPage.contextPut("hasObjectives", Boolean.FALSE);
    }
    if (isAssessable) {
        ScoreEvaluation scoreEval = scormNode.getUserScoreEvaluation(userCourseEnv);
        Float score = scoreEval.getScore();
        if (ScormEditController.CONFIG_ASSESSABLE_TYPE_SCORE.equals(assessableType)) {
            startPage.contextPut("score", score != null ? AssessmentHelper.getRoundedScore(score) : "0");
        }
        startPage.contextPut("hasPassedValue", (scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
        startPage.contextPut("passed", scoreEval.getPassed());
        boolean resultsVisible = scoreEval.getUserVisible() == null || scoreEval.getUserVisible().booleanValue();
        startPage.contextPut("resultsVisible", resultsVisible);
        if (resultsVisible && scormNode.hasCommentConfigured()) {
            StringBuilder comment = Formatter.stripTabsAndReturns(scormNode.getUserUserComment(userCourseEnv));
            startPage.contextPut("comment", StringHelper.xssScan(comment));
        }
        startPage.contextPut("attempts", scormNode.getUserAttempts(userCourseEnv));
        if (ureq == null) {
            // High score need one
            ureq = new SyntheticUserRequest(getIdentity(), getLocale(), userSession);
        }
        HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, scormNode);
        if (highScoreCtr.isViewHighscore()) {
            Component highScoreComponent = highScoreCtr.getInitialComponent();
            startPage.put("highScore", highScoreComponent);
        }
    }
    startPage.contextPut("isassessable", Boolean.valueOf(isAssessable));
    main.setContent(startPage);
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) SyntheticUserRequest(org.olat.core.gui.util.SyntheticUserRequest) Component(org.olat.core.gui.components.Component)

Example 40 with ScoreEvaluation

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

the class PortfolioServiceImpl method setAssessmentStatus.

@Override
public void setAssessmentStatus(Identity assessedIdentity, BinderRef binderRef, AssessmentEntryStatus status, Identity coachingIdentity) {
    Boolean fullyAssessed = Boolean.FALSE;
    if (status == AssessmentEntryStatus.done) {
        fullyAssessed = Boolean.TRUE;
    }
    Binder binder = binderDao.loadByKey(binderRef.getKey());
    RepositoryEntry entry = binder.getEntry();
    if ("CourseModule".equals(entry.getOlatResource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(entry);
        CourseNode courseNode = course.getRunStructure().getNode(binder.getSubIdent());
        if (courseNode instanceof PortfolioCourseNode) {
            PortfolioCourseNode pfNode = (PortfolioCourseNode) courseNode;
            UserCourseEnvironment userCourseEnv = AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
            AssessmentEvaluation eval = pfNode.getUserScoreEvaluation(userCourseEnv);
            ScoreEvaluation scoreEval = new ScoreEvaluation(eval.getScore(), eval.getPassed(), status, true, fullyAssessed, null, null, binder.getKey());
            pfNode.updateUserScoreEvaluation(scoreEval, userCourseEnv, coachingIdentity, false, Role.coach);
        }
    } else {
        OLATResource resource = ((BinderImpl) binder.getTemplate()).getOlatResource();
        RepositoryEntry referenceEntry = repositoryService.loadByResourceKey(resource.getKey());
        AssessmentEntry assessmentEntry = assessmentService.getOrCreateAssessmentEntry(assessedIdentity, null, binder.getEntry(), binder.getSubIdent(), referenceEntry);
        assessmentEntry.setFullyAssessed(fullyAssessed);
        assessmentEntry.setAssessmentStatus(status);
        assessmentService.updateAssessmentEntry(assessmentEntry);
    }
}
Also used : Binder(org.olat.modules.portfolio.Binder) AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder) SynchedBinder(org.olat.modules.portfolio.model.SynchedBinder) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) OLATResource(org.olat.resource.OLATResource) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) CourseNode(org.olat.course.nodes.CourseNode) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry)

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