From 6e09dd918d2b0f82f60fd32bee561a98c45290ea Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Mon, 19 Nov 2018 11:04:00 +0100
Subject: [PATCH] OO-3304: prevent opening twice the survey

---
 .../quality/ui/ExecutionController.java       |  4 +++
 .../ExecutorParticipationsListController.java | 25 ++++++++++---------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/olat/modules/quality/ui/ExecutionController.java b/src/main/java/org/olat/modules/quality/ui/ExecutionController.java
index 78c2452c3e3..45a045c3d65 100644
--- a/src/main/java/org/olat/modules/quality/ui/ExecutionController.java
+++ b/src/main/java/org/olat/modules/quality/ui/ExecutionController.java
@@ -62,6 +62,10 @@ public class ExecutionController extends BasicController {
 		initVelocityContainer(ureq);
 		putInitialPanel(mainVC);
 	}
+	
+	public QualityExecutorParticipation getQualityParticipant() {
+		return qualityParticipation;
+	}
 
 	protected void initVelocityContainer(UserRequest ureq) {
 		back = LinkFactory.createLinkBack(mainVC, this);
diff --git a/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java b/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java
index 335be8e6b33..3b420060053 100644
--- a/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java
+++ b/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java
@@ -199,18 +199,19 @@ public class ExecutorParticipationsListController extends FormBasicController im
 			return;
 		}
 		
-		
-		OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_EXECUTION_TYPE,
-				participation.getParticipationRef().getKey());
-		WindowControl bwControl = addToHistory(ureq, ores, null);
-		executionCtrl = new ExecutionController(ureq, bwControl, participation);
-		listenTo(executionCtrl);
-		
-		WindowControl wControl = getWindowControl();
-		ChiefController cc = wControl.getWindowBackOffice().getChiefController();
-		String businessPath = executionCtrl.getWindowControlForDebug().getBusinessControl().getAsString();
-		cc.getScreenMode().setMode(Mode.full, businessPath);
-		wControl.pushToMainArea(executionCtrl.getInitialComponent());
+		if(executionCtrl == null || !participation.equals(executionCtrl.getQualityParticipant())) {
+			OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_EXECUTION_TYPE,
+					participation.getParticipationRef().getKey());
+			WindowControl bwControl = addToHistory(ureq, ores, null);
+			executionCtrl = new ExecutionController(ureq, bwControl, participation);
+			listenTo(executionCtrl);
+			
+			WindowControl wControl = getWindowControl();
+			ChiefController cc = wControl.getWindowBackOffice().getChiefController();
+			String businessPath = executionCtrl.getWindowControlForDebug().getBusinessControl().getAsString();
+			cc.getScreenMode().setMode(Mode.full, businessPath);
+			wControl.pushToMainArea(executionCtrl.getInitialComponent());
+		}
 	}
 
 	@Override
-- 
GitLab