From 5e999401b2c2c5ce0600552e9906fe9bbf9b20e2 Mon Sep 17 00:00:00 2001
From: uhensler <urs.hensler@frentix.com>
Date: Wed, 4 Mar 2020 16:22:11 +0100
Subject: [PATCH] OO-4300: Show start date even if it is in the past

---
 .../learningpath/ui/LearningPathListController.java   | 11 +++++++++++
 .../olat/course/learningpath/ui/LearningPathRow.java  |  7 ++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/olat/course/learningpath/ui/LearningPathListController.java b/src/main/java/org/olat/course/learningpath/ui/LearningPathListController.java
index c03f081ea9e..f13c606890f 100644
--- a/src/main/java/org/olat/course/learningpath/ui/LearningPathListController.java
+++ b/src/main/java/org/olat/course/learningpath/ui/LearningPathListController.java
@@ -56,6 +56,8 @@ import org.olat.course.assessment.CourseAssessmentService;
 import org.olat.course.assessment.IndentedNodeRenderer;
 import org.olat.course.assessment.handler.AssessmentConfig;
 import org.olat.course.assessment.ui.tool.AssessmentStatusCellRenderer;
+import org.olat.course.learningpath.LearningPathConfigs;
+import org.olat.course.learningpath.LearningPathService;
 import org.olat.course.learningpath.manager.LearningPathCourseTreeModelBuilder;
 import org.olat.course.learningpath.ui.LearningPathDataModel.LearningPathCols;
 import org.olat.course.nodes.CourseNode;
@@ -97,6 +99,8 @@ public class LearningPathListController extends FormBasicController implements T
 	private AssessmentService assessmentService;
 	@Autowired
 	private CourseAssessmentService courseAssessmentService;
+	@Autowired
+	private LearningPathService learningPathService;
 
 	public LearningPathListController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel,
 			UserCourseEnvironment userCourseEnv, boolean canEdit) {
@@ -216,11 +220,18 @@ public class LearningPathListController extends FormBasicController implements T
 	private LearningPathRow forgeRow(LearningPathTreeNode treeNode, LearningPathRow parent) {
 		LearningPathRow row = new LearningPathRow(treeNode);
 		row.setParent(parent);
+		forgeStartDate(row);
 		forgeEndDate(row);
 		forgeObligation(row);
 		return row;
 	}
 
+	private void forgeStartDate(LearningPathRow row) {
+		LearningPathConfigs learningPathConfigs = learningPathService.getConfigs(row.getCourseNode());
+		Date startDate = learningPathConfigs.getStartDate();
+		row.setStartDate(startDate);
+	}
+
 	private void forgeEndDate(LearningPathRow row) {
 		Overridable<Date> endDate = row.getEndDate();
 		if (!canEdit && !endDate.isOverridden()) {
diff --git a/src/main/java/org/olat/course/learningpath/ui/LearningPathRow.java b/src/main/java/org/olat/course/learningpath/ui/LearningPathRow.java
index bc904a31c44..1537ef98019 100644
--- a/src/main/java/org/olat/course/learningpath/ui/LearningPathRow.java
+++ b/src/main/java/org/olat/course/learningpath/ui/LearningPathRow.java
@@ -38,6 +38,7 @@ import org.olat.modules.assessment.model.AssessmentObligation;
 public class LearningPathRow implements FlexiTreeTableNode, IndentedCourseNode {
 	
 	private final LearningPathTreeNode learningPathNode;
+	private Date startDate;
 	private FormLink endDateFormItem;
 	private String translatedObligation;
 	private FormLink obligationFormItem;
@@ -89,7 +90,11 @@ public class LearningPathRow implements FlexiTreeTableNode, IndentedCourseNode {
 	}
 	
 	public Date getStartDate() {
-		return learningPathNode.getStartDate();
+		return startDate;
+	}
+
+	public void setStartDate(Date startDate) {
+		this.startDate = startDate;
 	}
 
 	public FormLink getEndDateFormItem() {
-- 
GitLab