diff --git a/src/main/java/org/olat/course/assessment/NewCachePersistingAssessmentManager.java b/src/main/java/org/olat/course/assessment/NewCachePersistingAssessmentManager.java index 711ecb5f5d4daafa0803b2c463ad8dadf10928d3..1a65acc3b0a072b92ad815b9896a909e60ae431f 100644 --- a/src/main/java/org/olat/course/assessment/NewCachePersistingAssessmentManager.java +++ b/src/main/java/org/olat/course/assessment/NewCachePersistingAssessmentManager.java @@ -62,6 +62,7 @@ import org.olat.course.certificate.model.CertificateInfos; import org.olat.course.nodes.AssessableCourseNode; import org.olat.course.nodes.CourseNode; import org.olat.course.properties.CoursePropertyManager; +import org.olat.course.run.scoring.ScoreAccounting; import org.olat.course.run.scoring.ScoreEvaluation; import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.properties.Property; @@ -868,6 +869,7 @@ public class NewCachePersistingAssessmentManager extends BasicManager implements // we could also sync on the assessedIdentity. Long attempts = CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(createOLATResourceableForLocking(assessedIdentity), new SyncerCallback<Long>(){ + @Override public Long execute() { Long attempts = null; Float score = scoreEvaluation.getScore(); @@ -879,26 +881,36 @@ public class NewCachePersistingAssessmentManager extends BasicManager implements if(incrementUserAttempts) { attempts = incrementNodeAttemptsProperty(courseNode, assessedIdentity, cpm); } + + boolean evaluated = false; + ScoreAccounting scoreAccounting = assessedUserCourseEnv.getScoreAccounting(); if(courseNode instanceof AssessableCourseNode) { - assessedUserCourseEnv.getScoreAccounting().scoreInfoChanged((AssessableCourseNode)courseNode, scoreEvaluation); - // Update users efficiency statement - EfficiencyStatementManager esm = EfficiencyStatementManager.getInstance(); - esm.updateUserEfficiencyStatement(assessedUserCourseEnv); + evaluated = true;//scoreInfoChanged() == evaluateAll() + scoreAccounting.scoreInfoChanged((AssessableCourseNode)courseNode, scoreEvaluation); + // Update users efficiency statement + EfficiencyStatementManager.getInstance().updateUserEfficiencyStatement(assessedUserCourseEnv); } - 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); + if(course.getCourseConfig().isAutomaticCertificationEnabled()) { + CourseNode rootNode = assessedUserCourseEnv.getCourseEnvironment().getRunStructure().getRootNode(); + if(!evaluated) { + scoreAccounting.evaluateAll(); + } + + ScoreEvaluation rootEval = scoreAccounting.evalCourseNode((AssessableCourseNode)rootNode); + if(rootEval != null && rootEval.getPassed() != null && rootEval.getPassed().booleanValue()) { + 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, rootEval.getScore(), rootEval.getPassed()); + certificatesManager.generateCertificate(certificateInfos, courseEntry, template, true); } - CertificateInfos certificateInfos = new CertificateInfos(assessedIdentity, score, passed); - certificatesManager.generateCertificate(certificateInfos, courseEntry, template, true); } } - return attempts; }}); diff --git a/src/main/java/org/olat/course/certificate/ui/CertificatesOptionsController.java b/src/main/java/org/olat/course/certificate/ui/CertificatesOptionsController.java index e0ed8626ead76f519dd622c28c1400a04a7304f0..225c859cc7cc2fdf3be5987c1b460a8ed2a62ecc 100644 --- a/src/main/java/org/olat/course/certificate/ui/CertificatesOptionsController.java +++ b/src/main/java/org/olat/course/certificate/ui/CertificatesOptionsController.java @@ -144,6 +144,7 @@ public class CertificatesOptionsController extends FormBasicController { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { setFormTitle("options.certificates.title"); setFormTitleIconCss("o_icon o_icon_certificate"); + setFormDescription("options.certificates.descr"); setFormContextHelp("Course Settings#_leistungsnachweis"); formLayout.setElementCssClass("o_sel_course_certificates"); diff --git a/src/main/java/org/olat/course/certificate/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/certificate/ui/_i18n/LocalStrings_de.properties index d16bbda881951092a230083b56ce120a1aeca60b..61b26bf188e3a1e45c2fea9f817c4806111470af 100644 --- a/src/main/java/org/olat/course/certificate/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/course/certificate/ui/_i18n/LocalStrings_de.properties @@ -15,7 +15,8 @@ details.course.infos=Kursdetails download.button=Zertifikat herunterladen -options.certificates.title=Konfiguration Leistungnachweis +options.certificates.title=Damit Kurse als bestanden angezeigt werden k\u00F6nnen, muss im Kurshauptknoten zwingend im "Punkte"-Tab die Option <strong>Bestanden berechnen?</strong> aktiviert werden. +options.certificates.descr=Test generate.certificate=Zertifikat erzeugen no.certificate=Kein Zertifikat vorhanden pdf.certificates=PDF Zertifikat erzeugen diff --git a/src/main/java/org/olat/course/certificate/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/course/certificate/ui/_i18n/LocalStrings_en.properties index 5fc55b377781468dcc85498bc2ba2a009fcef3c4..c754e85dce250765dd278e68939b8b7e094ca7a5 100644 --- a/src/main/java/org/olat/course/certificate/ui/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/course/certificate/ui/_i18n/LocalStrings_en.properties @@ -35,6 +35,7 @@ notifications.desc={0} received a new certificate. notifications.header=New certificates for the course "{0}". notifications.title=New Certificates in course "{0}". options.certificates.title=Evidence of achievement configuration +options.certificates.descr=Courses will only be listed as passed if the checkbox <strong>Calculate passing score?</strong> is selected in the "Score" tab in the course root node. orientation=Orientation pdf.certificates=Generate PDF certificate pdf.certificates.auto=Automatically after passing the course diff --git a/src/main/java/org/olat/portfolio/ui/artefacts/collect/ArtefactWizzardStepsController.java b/src/main/java/org/olat/portfolio/ui/artefacts/collect/ArtefactWizzardStepsController.java index e68f807022fd3691d53f8d63235db9df3ae66e29..d19969b388788f86ca44d5af1b6a14a6c021d90e 100755 --- a/src/main/java/org/olat/portfolio/ui/artefacts/collect/ArtefactWizzardStepsController.java +++ b/src/main/java/org/olat/portfolio/ui/artefacts/collect/ArtefactWizzardStepsController.java @@ -35,6 +35,7 @@ import org.olat.core.gui.control.generic.wizard.Step; import org.olat.core.gui.control.generic.wizard.StepRunnerCallback; import org.olat.core.gui.control.generic.wizard.StepsMainRunController; import org.olat.core.id.OLATResourceable; +import org.olat.core.util.StringHelper; import org.olat.core.util.vfs.VFSContainer; import org.olat.portfolio.EPArtefactHandler; import org.olat.portfolio.PortfolioModule; @@ -204,7 +205,7 @@ public class ArtefactWizzardStepsController extends BasicController { if (source == collectStepsCtrl) { if (event == Event.CHANGED_EVENT) { ePFMgr.updateArtefact(artefact); - showInfo("collect.success", artefact.getTitle()); + showInfo("collect.success", StringHelper.escapeHtml(artefact.getTitle())); } else { // set back artefact-values // artefact = ePFMgr.loadArtefact(artefact.getKey());