From c492dfb246e4813212912b17058bc89d6451df9c Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Thu, 14 Sep 2017 12:21:45 +0200
Subject: [PATCH] OO-3016: only calculate high score and certification link if
 they are shown in UI

---
 .../course/nodes/st/STCourseNodeRunController.java   | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/olat/course/nodes/st/STCourseNodeRunController.java b/src/main/java/org/olat/course/nodes/st/STCourseNodeRunController.java
index 1d8cdb67b42..9f3777f29c7 100644
--- a/src/main/java/org/olat/course/nodes/st/STCourseNodeRunController.java
+++ b/src/main/java/org/olat/course/nodes/st/STCourseNodeRunController.java
@@ -97,7 +97,7 @@ public class STCourseNodeRunController extends BasicController {
 		myContent = createVelocityContainer("run");
 		myContent.setDomReplacementWrapperRequired(false); // we provide our own DOM replacement ID
 		
-		if (se != null){
+		if (se != null && (stCourseNode.hasScoreConfigured() || stCourseNode.hasPassedConfigured())) {
 			HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, wControl, userCourseEnv, stCourseNode);
 			if (highScoreCtr.isViewHighscore()) {
 				Component highScoreComponent = highScoreCtr.getInitialComponent();
@@ -175,10 +175,12 @@ public class STCourseNodeRunController extends BasicController {
 			myContent.contextPut("hasScore", new Boolean(stCourseNode.hasScoreConfigured()));
 			myContent.contextPut("hasPassed", new Boolean(stCourseNode.hasPassedConfigured()));
 
-			CourseConfig cc = userCourseEnv.getCourseEnvironment().getCourseConfig();
-			if((cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled())
-					&& userCourseEnv.hasEfficiencyStatementOrCertificate(false)) {
-				certificationLink = LinkFactory.createButton("certification", myContent, this);
+			if(stCourseNode.hasScoreConfigured() || stCourseNode.hasPassedConfigured()) {
+				CourseConfig cc = userCourseEnv.getCourseEnvironment().getCourseConfig();
+				if((cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled())
+						&& userCourseEnv.hasEfficiencyStatementOrCertificate(false)) {
+					certificationLink = LinkFactory.createButton("certification", myContent, this);
+				}
 			}
 		}
 
-- 
GitLab