From ca9cb86a7d9ee2236908a80d24e24d3257ac9d9e Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Fri, 9 Nov 2012 13:14:12 -0500 Subject: [PATCH] show proper course will-start/started/ended text on dashboard --- common/lib/xmodule/xmodule/course_module.py | 4 ++++ lms/templates/dashboard.html | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 33c222bd7c..2b6232d366 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -250,6 +250,10 @@ class CourseDescriptor(SequenceDescriptor): displayed_start = self._try_parse_time('advertised_start') or self.start return time.strftime("%b %d, %Y", displayed_start) + @property + def end_date_text(self): + return time.strftime("%b %d, %Y", self.end) + # An extra property is used rather than the wiki_slug/number because # there are courses that change the number for different runs. This allows # courses to share the same css_class across runs even if they have diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 01baade6f7..1d36f8f958 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -137,7 +137,15 @@

${course.number} ${course.title}

-

Course Completed - Nov 6, 2012

+

+ % if course.has_ended(): + Course Completed - ${course.end_date_text} + % elif course.has_started(): + Course Started - ${course.start_date_text} + % else: # hasn't started yet + Course Starts - ${course.start_date_text} + % endif +

% if course.id in show_courseware_links_for:

View Courseware