Commit a26560de by Noraiz Anwar Committed by GitHub

Merge pull request #14891 from edx/noriaz/ECOM-7537

ECOM-7537 Priortize advertised start date to diplay on learner's dashboard
parents 79d9c798 a7ceb880
......@@ -306,6 +306,39 @@ class LmsDashboardPageTest(BaseLmsDashboardTest):
# and course starts within 5 days
self.assertEqual(course_date, expected_course_date)
def test_advertised_start_date(self):
"""
Scenario:
Course Date should be advertised start date
if the course on student dashboard has `Course Advertised Start` set.
As a Student,
Given that I have enrolled to a course
And the course has `Course Advertised Start` set.
When I visit dashboard page
Then the advertised start date should be displayed rather course start date"
"""
course_start_date = self.now + datetime.timedelta(days=2)
course_advertised_start = "Winter 2018"
self.course_fixture.add_course_details({
'start_date': course_start_date,
})
self.course_fixture.configure_course()
self.course_fixture.add_advanced_settings({
u"advertised_start": {u"value": course_advertised_start}
})
self.course_fixture._add_advanced_settings()
expected_course_date = "Starts - {start_date}".format(start_date=course_advertised_start)
self.dashboard_page.visit()
course_date = self.dashboard_page.get_course_date()
self.assertEqual(course_date, expected_course_date)
def test_profile_img_alt_empty(self):
"""
Validate value of profile image alt attribue is null
......
......@@ -110,19 +110,19 @@ from util.course import get_link_for_about_page
course_date = course_overview.end
elif course_overview.has_started():
container_string = _("Started - {date}")
course_date = course_overview.start
course_date = course_overview.dashboard_start_display
elif course_overview.starts_within(days=5):
container_string = _("Starts - {date}")
course_date = course_overview.start
course_date = course_overview.dashboard_start_display
format = 'defaultFormat'
else: ## hasn't started yet
container_string = _("Starts - {date}")
course_date = course_overview.start
course_date = course_overview.dashboard_start_display
endif
endif
%>
% if isinstance(course_date, str):
% if isinstance(course_date, basestring):
<span class="info-date-block" data-tooltip="Hi">${_(container_string).format(date=course_date)}</span>
% elif course_date is not None:
<%
......
......@@ -361,6 +361,13 @@ class CourseOverview(TimeStampedModel):
"""
return block_metadata_utils.display_name_with_default_escaped(self)
@property
def dashboard_start_display(self):
"""
Return start date to diplay on learner's dashboard, preferably `Course Advertised Start`
"""
return self.advertised_start or self.start
def has_started(self):
"""
Returns whether the the course has started.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment