From 1b6ddc35bbd0d053571b0d2ab5d6f0955d6b69ef Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Tue, 10 Sep 2019 14:59:37 +0200
Subject: [PATCH] OO-4240: allow collecting task without task and optional

---
 .../org/olat/course/nodes/gta/ui/GTACoachController.java     | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/main/java/org/olat/course/nodes/gta/ui/GTACoachController.java b/src/main/java/org/olat/course/nodes/gta/ui/GTACoachController.java
index ae132e3a3f8..207144120eb 100644
--- a/src/main/java/org/olat/course/nodes/gta/ui/GTACoachController.java
+++ b/src/main/java/org/olat/course/nodes/gta/ui/GTACoachController.java
@@ -737,6 +737,11 @@ public class GTACoachController extends GTAAbstractController implements Assessm
 			submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
 		}
 		
+		if(task == null && gtaNode.isOptional()) {
+			TaskProcess firstStep = gtaManager.firstStep(gtaNode);
+			task = gtaManager.createTask(null, taskList, firstStep, assessedGroup, assessedIdentity, gtaNode);
+		}
+		
 		int numOfDocs = submittedDocuments == null ? 0 : submittedDocuments.length;
 		task = gtaManager.collectTask(task, gtaNode, numOfDocs);
 		showInfo("run.documents.successfully.submitted");
-- 
GitLab