Search in sources :

Example 6 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.

the class ProjectBrokerCourseNode method getUserLog.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#getUserLog(org.olat.course.run.userview.UserCourseEnvironment)
 */
@Override
public String getUserLog(UserCourseEnvironment userCourseEnvironment) {
    UserNodeAuditManager am = userCourseEnvironment.getCourseEnvironment().getAuditManager();
    String logValue = am.getUserNodeLog(this, userCourseEnvironment.getIdentityEnvironment().getIdentity());
    return logValue;
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager)

Example 7 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.

the class MSCourseNodeRunController method exposeUserDataToVC.

private void exposeUserDataToVC(UserRequest ureq) {
    AssessmentEntry assessmentEntry = courseNode.getUserAssessmentEntry(userCourseEnv);
    if (assessmentEntry == null) {
        myContent.contextPut("hasPassedValue", Boolean.FALSE);
        myContent.contextPut("passed", Boolean.FALSE);
        hasPassed = hasScore = hasComment = false;
    } else {
        String rawComment = assessmentEntry.getComment();
        hasPassed = assessmentEntry.getPassed() != null;
        hasScore = assessmentEntry.getScore() != null;
        hasComment = courseNode.hasCommentConfigured() && StringHelper.containsNonWhitespace(rawComment);
        boolean resultsVisible = overrideUserResultsVisiblity || assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
        myContent.contextPut("resultsVisible", resultsVisible);
        myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
        myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
        myContent.contextPut("passed", assessmentEntry.getPassed());
        if (resultsVisible) {
            if (hasComment) {
                StringBuilder comment = Formatter.stripTabsAndReturns(rawComment);
                myContent.contextPut("comment", StringHelper.xssScan(comment));
                myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
            }
            if (courseNode.hasIndividualAsssessmentDocuments()) {
                List<File> docs = courseNode.getIndividualAssessmentDocuments(userCourseEnv);
                mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                myContent.contextPut("docsMapperUri", mapperUri);
                myContent.contextPut("docs", docs);
                myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
                if (download == null) {
                    download = new DisplayOrDownloadComponent("", null);
                    myContent.put("download", download);
                }
            }
        }
    }
    if (showLog) {
        UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
        myContent.contextPut("log", am.getUserNodeLog(courseNode, userCourseEnv.getIdentityEnvironment().getIdentity()));
    }
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) DisplayOrDownloadComponent(org.olat.core.gui.components.download.DisplayOrDownloadComponent) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 8 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.

the class IQRunController method exposeUserTestDataToVC.

private void exposeUserTestDataToVC(UserRequest ureq) {
    // config : show score info
    Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
    if (enableScoreInfoObject != null) {
        myContent.contextPut("enableScoreInfo", enableScoreInfoObject);
    } else {
        myContent.contextPut("enableScoreInfo", Boolean.TRUE);
    }
    // configuration data
    myContent.contextPut("attemptsConfig", modConfig.get(IQEditController.CONFIG_KEY_ATTEMPTS));
    // user data
    Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
    if (courseNode instanceof PersistentAssessableCourseNode) {
        PersistentAssessableCourseNode acn = (PersistentAssessableCourseNode) courseNode;
        AssessmentEntry assessmentEntry = acn.getUserAssessmentEntry(userCourseEnv);
        if (assessmentEntry == null) {
            myContent.contextPut("blockAfterSuccess", Boolean.FALSE);
            myContent.contextPut("score", null);
            myContent.contextPut("hasPassedValue", Boolean.FALSE);
            myContent.contextPut("passed", Boolean.FALSE);
            myContent.contextPut("comment", null);
            myContent.contextPut("docs", null);
            myContent.contextPut("attempts", 0);
        } else {
            // block if test passed (and config set to check it)
            Boolean blockAfterSuccess = modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS);
            Boolean blocked = Boolean.FALSE;
            if (blockAfterSuccess != null && blockAfterSuccess.booleanValue()) {
                Boolean passed = assessmentEntry.getPassed();
                if (passed != null && passed.booleanValue()) {
                    blocked = Boolean.TRUE;
                }
            }
            myContent.contextPut("blockAfterSuccess", blocked);
            boolean resultsVisible = assessmentEntry.getUserVisibility() == null || assessmentEntry.getUserVisibility().booleanValue();
            myContent.contextPut("resultsVisible", resultsVisible);
            myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
            myContent.contextPut("hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
            myContent.contextPut("passed", assessmentEntry.getPassed());
            if (resultsVisible) {
                if (acn.hasCommentConfigured()) {
                    StringBuilder comment = Formatter.stripTabsAndReturns(assessmentEntry.getComment());
                    myContent.contextPut("comment", StringHelper.xssScan(comment));
                    myContent.contextPut("in-comment", isPanelOpen(ureq, "comment", true));
                }
                if (acn.hasIndividualAsssessmentDocuments()) {
                    List<File> docs = acn.getIndividualAssessmentDocuments(userCourseEnv);
                    String mapperUri = registerCacheableMapper(ureq, null, new DocumentsMapper(docs));
                    myContent.contextPut("docsMapperUri", mapperUri);
                    myContent.contextPut("docs", docs);
                    myContent.contextPut("in-assessmentDocuments", isPanelOpen(ureq, "assessmentDocuments", true));
                }
            }
            myContent.contextPut("attempts", assessmentEntry.getAttempts() == null ? 0 : assessmentEntry.getAttempts());
        }
    }
    UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager();
    myContent.contextPut("log", am.getUserNodeLog(courseNode, identity));
    exposeResults(ureq);
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) PersistentAssessableCourseNode(org.olat.course.nodes.PersistentAssessableCourseNode) Identity(org.olat.core.id.Identity) DocumentsMapper(org.olat.course.nodes.ms.DocumentsMapper) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) File(java.io.File)

Example 9 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.

the class IQTESTCourseNode method getUserLog.

@Override
public String getUserLog(UserCourseEnvironment userCourseEnvironment) {
    UserNodeAuditManager am = userCourseEnvironment.getCourseEnvironment().getAuditManager();
    Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
    return am.getUserNodeLog(this, mySelf);
}
Also used : UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) Identity(org.olat.core.id.Identity)

Example 10 with UserNodeAuditManager

use of org.olat.course.auditing.UserNodeAuditManager in project OpenOLAT by OpenOLAT.

the class NewCachePersistingAssessmentManager method saveScoreEvaluation.

/**
 * @see org.olat.course.assessment.AssessmentManager#saveScoreEvaluation(org.olat.course.nodes.CourseNode, org.olat.core.id.Identity, org.olat.core.id.Identity, org.olat.course.run.scoring.ScoreEvaluation)
 */
public void saveScoreEvaluation(final CourseNode courseNode, final Identity identity, final Identity assessedIdentity, final ScoreEvaluation scoreEvaluation, final UserCourseEnvironment userCourseEnv, final boolean incrementUserAttempts) {
    final ICourse course = CourseFactory.loadCourse(ores);
    final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    final RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    // o_clusterREVIEW we could sync on a element finer than course, e.g. the composite course+assessIdentity.
    // +: concurrency would be higher
    // -: many entries (num of courses * visitors of given course) in the locktable.
    // we could also sync on the assessedIdentity.
    Long attempts = CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(createOLATResourceableForLocking(assessedIdentity), new SyncerCallback<Long>() {

        public Long execute() {
            Long attempts = null;
            Float score = scoreEvaluation.getScore();
            Boolean passed = scoreEvaluation.getPassed();
            saveNodeScore(courseNode, assessedIdentity, score, cpm);
            saveNodePassed(courseNode, assessedIdentity, passed, cpm);
            saveAssessmentID(courseNode, assessedIdentity, scoreEvaluation.getAssessmentID(), cpm);
            if (incrementUserAttempts) {
                attempts = incrementNodeAttemptsProperty(courseNode, assessedIdentity, cpm);
            }
            if (courseNode instanceof AssessableCourseNode) {
                userCourseEnv.getScoreAccounting().evaluateAll();
                // Update users efficiency statement
                EfficiencyStatementManager esm = CoreSpringFactory.getImpl(EfficiencyStatementManager.class);
                esm.updateUserEfficiencyStatement(userCourseEnv);
            }
            if (passed != null && passed.booleanValue() && course.getCourseConfig().isAutomaticCertificationEnabled()) {
                CertificatesManager certificatesManager = CoreSpringFactory.getImpl(CertificatesManager.class);
                if (certificatesManager.isCertificationAllowed(assessedIdentity, courseEntry)) {
                    CertificateTemplate template = null;
                    Long templateId = course.getCourseConfig().getCertificateTemplate();
                    if (templateId != null) {
                        template = certificatesManager.getTemplateById(templateId);
                    }
                    CertificateInfos certificateInfos = new CertificateInfos(assessedIdentity, score, passed);
                    certificatesManager.generateCertificate(certificateInfos, courseEntry, template, true);
                }
            }
            return attempts;
        }
    });
    // node log
    UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
    am.appendToUserNodeLog(courseNode, identity, assessedIdentity, SCORE + " set to: " + String.valueOf(scoreEvaluation.getScore()));
    if (scoreEvaluation.getPassed() != null) {
        am.appendToUserNodeLog(courseNode, identity, assessedIdentity, PASSED + " set to: " + scoreEvaluation.getPassed().toString());
    } else {
        am.appendToUserNodeLog(courseNode, identity, assessedIdentity, PASSED + " set to \"undefined\"");
    }
    if (scoreEvaluation.getAssessmentID() != null) {
        am.appendToUserNodeLog(courseNode, assessedIdentity, assessedIdentity, ASSESSMENT_ID + " set to: " + scoreEvaluation.getAssessmentID().toString());
    }
    // notify about changes
    AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_SCORE_EVAL_CHANGED, assessedIdentity);
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace, course);
    // user activity logging
    if (scoreEvaluation.getScore() != null) {
        ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_SCORE_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiScore, "", String.valueOf(scoreEvaluation.getScore())));
    }
    if (scoreEvaluation.getPassed() != null) {
        ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_PASSED_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiPassed, "", String.valueOf(scoreEvaluation.getPassed())));
    } else {
        ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_PASSED_UPDATED, getClass(), LoggingResourceable.wrap(assessedIdentity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiPassed, "", "undefined"));
    }
    if (incrementUserAttempts && attempts != null) {
        ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_ATTEMPTS_UPDATED, getClass(), LoggingResourceable.wrap(identity), LoggingResourceable.wrapNonOlatResource(StringResourceableType.qtiAttempts, "", String.valueOf(attempts)));
    }
}
Also used : CertificateTemplate(org.olat.course.certificate.CertificateTemplate) EfficiencyStatementManager(org.olat.course.assessment.manager.EfficiencyStatementManager) CertificateInfos(org.olat.course.certificate.model.CertificateInfos) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) AssessmentChangedEvent(org.olat.course.assessment.AssessmentChangedEvent) CertificatesManager(org.olat.course.certificate.CertificatesManager) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Aggregations

UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)46 ICourse (org.olat.course.ICourse)18 AssessmentEntry (org.olat.modules.assessment.AssessmentEntry)16 Identity (org.olat.core.id.Identity)14 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)12 File (java.io.File)10 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)10 Date (java.util.Date)8 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)4 SystemFileFilter (org.olat.core.util.io.SystemFileFilter)4 MailContext (org.olat.core.util.mail.MailContext)4 Structure (org.olat.course.Structure)4 AssessmentManager (org.olat.course.assessment.AssessmentManager)4 CertificateTemplate (org.olat.course.certificate.CertificateTemplate)4 CertificateInfos (org.olat.course.certificate.model.CertificateInfos)4 CourseConfig (org.olat.course.config.CourseConfig)4 CourseGroupManager (org.olat.course.groupsandrights.CourseGroupManager)4 CourseNode (org.olat.course.nodes.CourseNode)4