diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fc52c5156e..d43e2b1dcd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,10 @@ These are notable changes in edx-platform. This is a rolling list of changes, in roughly chronological order, most recent first. Add your entries at or near the top. Include a label indicating the component affected. +LMS: If the course start date is kept at the default studio value (Jan 1, 2030) +and advertised_start is not set, the start date is not displayed in the +/courses tile view, the course about page, or the dashboard + Blades: Add role parameter to LTI. BLD-583. Blades: Bugfix "In Firefox YouTube video with start time plays from 00:00:00". diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index a7519902c9..2ba70ef929 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -821,6 +821,10 @@ class CourseDescriptor(CourseFields, SequenceDescriptor): @property def start_date_text(self): + """ + Returns the desired text corresponding the course's start date. Prefers .advertised_start, + then falls back to .start + """ def try_parse_iso_8601(text): try: result = Date().from_json(text) @@ -835,12 +839,22 @@ class CourseDescriptor(CourseFields, SequenceDescriptor): if isinstance(self.advertised_start, basestring): return try_parse_iso_8601(self.advertised_start) - elif self.advertised_start is None and self.start is None: - # TODO this is an impossible state since the init function forces start to have a value - return 'TBD' + elif self.start_date_is_still_default: + _ = self.runtime.service(self, "i18n").ugettext + # Translators: TBD stands for 'To Be Determined' and is used when a course + # does not yet have an announced start date. + return _('TBD') else: return (self.advertised_start or self.start).strftime("%b %d, %Y") + @property + def start_date_is_still_default(self): + """ + Checks if the start date set for the course is still default, i.e. .start has not been modified, + and .advertised_start has not been set. + """ + return self.advertised_start is None and self.start == CourseFields.start.default + @property def end_date_text(self): """ diff --git a/common/lib/xmodule/xmodule/tests/test_course_module.py b/common/lib/xmodule/xmodule/tests/test_course_module.py index 74a10fe91f..7a60e29e37 100644 --- a/common/lib/xmodule/xmodule/tests/test_course_module.py +++ b/common/lib/xmodule/xmodule/tests/test_course_module.py @@ -134,23 +134,29 @@ class IsNewCourseTestCase(unittest.TestCase): print "Comparing %s to %s" % (a, b) assertion(a_score, b_score) + start_advertised_settings = [ + # start, advertised, result, is_still_default + ('2012-12-02T12:00', None, 'Dec 02, 2012', False), + ('2012-12-02T12:00', '2011-11-01T12:00', 'Nov 01, 2011', False), + ('2012-12-02T12:00', 'Spring 2012', 'Spring 2012', False), + ('2012-12-02T12:00', 'November, 2011', 'November, 2011', False), + (xmodule.course_module.CourseFields.start.default, None, 'TBD', True), + (xmodule.course_module.CourseFields.start.default, 'January 2014', 'January 2014', False), + ] + @patch('xmodule.course_module.datetime.now') def test_start_date_text(self, gmtime_mock): gmtime_mock.return_value = NOW - - settings = [ - # start, advertized, result - ('2012-12-02T12:00', None, 'Dec 02, 2012'), - ('2012-12-02T12:00', '2011-11-01T12:00', 'Nov 01, 2011'), - ('2012-12-02T12:00', 'Spring 2012', 'Spring 2012'), - ('2012-12-02T12:00', 'November, 2011', 'November, 2011'), - ] - - for s in settings: + for s in self.start_advertised_settings: d = get_dummy_course(start=s[0], advertised_start=s[1]) print "Checking start=%s advertised=%s" % (s[0], s[1]) self.assertEqual(d.start_date_text, s[2]) + def test_start_date_is_default(self): + for s in self.start_advertised_settings: + d = get_dummy_course(start=s[0], advertised_start=s[1]) + self.assertEqual(d.start_date_is_still_default, s[3]) + def test_display_organization(self): descriptor = get_dummy_course(start='2012-12-02T12:00', is_new=True) self.assertNotEqual(descriptor.location.org, descriptor.display_org_with_default) diff --git a/lms/static/sass/shared/_course_object.scss b/lms/static/sass/shared/_course_object.scss index 5ba5a90aa5..d359205194 100644 --- a/lms/static/sass/shared/_course_object.scss +++ b/lms/static/sass/shared/_course_object.scss @@ -226,14 +226,14 @@ width: 100%; .university { - border-right: 1px solid $border-color-2; color: $lighter-base-font-color; letter-spacing: 1px; - margin-right: 10px; - padding-right: 10px; } .start-date { + border-left: 1px solid $border-color-2; + margin-left: 5px; + padding-left: 10px; color: $lighter-base-font-color; letter-spacing: 1px; } diff --git a/lms/templates/course.html b/lms/templates/course.html index 849179bdbe..339df6bf8b 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -26,7 +26,9 @@ from courseware.courses import course_image_url, get_course_about_section
${get_course_about_section(course, 'university')} + % if not course.start_date_is_still_default: ${course.start_date_text} + % endif
diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index 0a6c5b346b..b2ccfdd0d3 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -248,8 +248,9 @@
  1. ${_("Course Number")}

    ${course.display_number_with_default | h}
  2. + % if not course.start_date_is_still_default:
  3. ${_("Classes Start")}

    ${course.start_date_text}
  4. - + % endif ## We plan to ditch end_date (which is not stored in course metadata), ## but for backwards compatibility, show about/end_date blob if it exists. % if get_course_about_section(course, "end_date") or course.end: diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index 3569e365ee..942b1d903f 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -43,6 +43,8 @@ ${_("Course Completed - {end_date}").format(end_date=course.end_date_text)} % elif course.has_started(): ${_("Course Started - {start_date}").format(start_date=course.start_date_text)} + % elif course.start_date_is_still_default: # Course start date TBD + ${_("Course has not yet started")} % else: # hasn't started yet ${_("Course Starts - {start_date}").format(start_date=course.start_date_text)} % endif