Search in sources :

Example 26 with AssessmentManager

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

the class GTACourseNode method getUserAssessmentEntry.

@Override
public AssessmentEntry getUserAssessmentEntry(UserCourseEnvironment userCourseEnv) {
    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
    Identity mySelf = userCourseEnv.getIdentityEnvironment().getIdentity();
    return am.getAssessmentEntry(this, mySelf);
}
Also used : AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 27 with AssessmentManager

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

the class GTACourseNode method getUserAttempts.

@Override
public Integer getUserAttempts(UserCourseEnvironment userCourseEnv) {
    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
    Identity assessedIdentity = userCourseEnv.getIdentityEnvironment().getIdentity();
    return am.getNodeAttempts(this, assessedIdentity);
}
Also used : AssessmentManager(org.olat.course.assessment.AssessmentManager) Identity(org.olat.core.id.Identity)

Example 28 with AssessmentManager

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

the class PortfolioCourseNodeRunController method updateAssessmentInfos.

private void updateAssessmentInfos(UserRequest ureq, Date returnDate) {
    if (returnDate != null || copyBinder != null) {
        String rDate = formatter.formatDateAndTime(returnDate);
        uifactory.addStaticTextElement("map.returnDate", rDate, infosContainer);
        // Fetch all score and passed and calculate score accounting for the entire course
        ScoreAccounting scoreAccounting = userCourseEnv.getScoreAccounting();
        scoreAccounting.evaluateAll();
        ScoreEvaluation scoreEval = scoreAccounting.evalCourseNode(courseNode);
        boolean resultsVisible = scoreEval.getUserVisible() == null || scoreEval.getUserVisible().booleanValue();
        assessmentInfosContainer.contextPut("resultsVisible", resultsVisible);
        // score
        assessmentInfosContainer.contextPut("hasScoreField", new Boolean(courseNode.hasScoreConfigured()));
        if (courseNode.hasScoreConfigured()) {
            Float score = scoreEval.getScore();
            Float minScore = courseNode.getMinScoreConfiguration();
            Float maxScore = courseNode.getMaxScoreConfiguration();
            assessmentInfosContainer.contextPut("scoreMin", AssessmentHelper.getRoundedScore(minScore));
            assessmentInfosContainer.contextPut("scoreMax", AssessmentHelper.getRoundedScore(maxScore));
            assessmentInfosContainer.contextPut("score", AssessmentHelper.getRoundedScore(score));
        }
        // passed
        assessmentInfosContainer.contextPut("hasPassedField", new Boolean(courseNode.hasPassedConfigured()));
        if (courseNode.hasPassedConfigured()) {
            Boolean passed = scoreEval.getPassed();
            assessmentInfosContainer.contextPut("passed", passed);
            assessmentInfosContainer.contextPut("hasPassedValue", new Boolean(passed != null));
            Float cutValue = courseNode.getCutValueConfiguration();
            assessmentInfosContainer.contextPut("passedCutValue", AssessmentHelper.getRoundedScore(cutValue));
        }
        // get comment
        if (resultsVisible) {
            if (courseNode.hasCommentConfigured()) {
                AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
                String comment = am.getNodeComment(courseNode, getIdentity());
                assessmentInfosContainer.contextPut("comment", comment);
                assessmentInfosContainer.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
            }
            if (courseNode.hasIndividualAsssessmentDocuments()) {
                List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
                String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                assessmentInfosContainer.contextPut("docsMapperUri", mapperUri);
                assessmentInfosContainer.contextPut("docs", docs);
                assessmentInfosContainer.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
            }
        }
        assessmentInfosContainer.setVisible(true);
    } else {
        assessmentInfosContainer.setVisible(false);
    }
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) ScoreAccounting(org.olat.course.run.scoring.ScoreAccounting) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) File(java.io.File)

Example 29 with AssessmentManager

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

the class IQRunController method submitAssessment.

@Override
public void submitAssessment(AssessmentInstance ai) {
    if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
        AssessmentContext ac = ai.getAssessmentContext();
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        Boolean fullyAssed = am.getNodeFullyAssessed(courseNode, getIdentity());
        String correctionMode = courseNode.getModuleConfiguration().getStringValue(IQEditController.CONFIG_CORRECTION_MODE);
        Boolean userVisibility;
        AssessmentEntryStatus assessmentStatus;
        if (IQEditController.CORRECTION_MANUAL.equals(correctionMode)) {
            assessmentStatus = AssessmentEntryStatus.inReview;
            userVisibility = Boolean.FALSE;
        } else {
            assessmentStatus = AssessmentEntryStatus.done;
            userVisibility = Boolean.TRUE;
        }
        ScoreEvaluation sceval = new ScoreEvaluation(ac.getScore(), ac.isPassed(), assessmentStatus, userVisibility, fullyAssed, null, null, ai.getAssessID());
        // assessment nodes are assessable
        AssessableCourseNode acn = (AssessableCourseNode) courseNode;
        acn.updateUserScoreEvaluation(sceval, userCourseEnv, getIdentity(), true, Role.user);
        // Mark publisher for notifications
        Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
        assessmentNotificationsHandler.markPublisherNews(getIdentity(), courseId);
        if (!assessmentStopped) {
            assessmentStopped = true;
            AssessmentEvent assessmentStoppedEvent = new AssessmentEvent(AssessmentEvent.TYPE.STOPPED, userSession);
            singleUserEventCenter.deregisterFor(this, assessmentInstanceOres);
            singleUserEventCenter.fireEventToListenersOf(assessmentStoppedEvent, assessmentEventOres);
        }
    } else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY)) {
        // save number of attempts
        // although this is not an assessable node we still use the assessment
        // manager since this one uses caching
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        am.incrementNodeAttempts(courseNode, getIdentity(), userCourseEnv, Role.user);
    } else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SELF)) {
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        am.incrementNodeAttempts(courseNode, getIdentity(), userCourseEnv, Role.user);
    }
}
Also used : AssessmentContext(org.olat.ims.qti.container.AssessmentContext) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) SelfAssessableCourseNode(org.olat.course.nodes.SelfAssessableCourseNode) ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) AssessmentManager(org.olat.course.assessment.AssessmentManager) AssessmentEntryStatus(org.olat.modules.assessment.model.AssessmentEntryStatus)

Example 30 with AssessmentManager

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

the class IQRunController method exposeUserQuestionnaireDataToVC.

private void exposeUserQuestionnaireDataToVC() {
    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
    Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
    // although this is not an assessable node we still use the assessment
    // manager since this one uses caching
    myContent.contextPut("attempts", am.getNodeAttempts(courseNode, identity));
}
Also used : AssessmentManager(org.olat.course.assessment.AssessmentManager) 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