Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c68af9d2
Commit
c68af9d2
authored
Nov 01, 2015
by
jsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show xseries upsell even if the course is not yet in session
ECOM-2780
parent
02744481
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
+27
-1
common/djangoapps/student/tests/tests.py
+26
-0
common/djangoapps/student/views.py
+1
-1
No files found.
common/djangoapps/student/tests/tests.py
View file @
c68af9d2
...
...
@@ -1033,6 +1033,32 @@ class DashboardTestXSeriesPrograms(ModuleStoreTestCase, ProgramsApiConfigMixin):
else
:
self
.
assertIn
(
'xseries-border-btn'
,
response
.
content
)
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'DISABLE_START_DATES'
:
False
})
@ddt.data
((
-
2
,
-
1
),
(
-
1
,
1
),
(
1
,
2
))
@ddt.unpack
def
test_start_end_offsets
(
self
,
start_days_offset
,
end_days_offset
):
"""Test that the xseries upsell messaging displays whether the course
has not yet started, is in session, or has already ended.
"""
self
.
course_1
.
start
=
datetime
.
now
(
pytz
.
UTC
)
+
timedelta
(
days
=
start_days_offset
)
self
.
course_1
.
end
=
datetime
.
now
(
pytz
.
UTC
)
+
timedelta
(
days
=
end_days_offset
)
self
.
update_course
(
self
.
course_1
,
self
.
user
.
id
)
CourseEnrollment
.
enroll
(
self
.
user
,
self
.
course_1
.
id
,
mode
=
'verified'
)
self
.
client
.
login
(
username
=
"jack"
,
password
=
"test"
)
self
.
create_config
(
enabled
=
True
,
enable_student_dashboard
=
True
)
with
patch
(
'student.views.get_course_programs_for_dashboard'
,
return_value
=
self
.
_create_program_data
([(
self
.
course_1
.
id
,
'active'
)])
)
as
mock_get_programs
:
response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
# ensure that our course id was included in the API call regardless of start/end dates
__
,
course_ids
=
mock_get_programs
.
call_args
[
0
]
self
.
assertEqual
(
list
(
course_ids
),
[
self
.
course_1
.
id
])
# count total courses appearing on student dashboard
self
.
_assert_responses
(
response
,
1
)
@ddt.data
(
(
'unpublished'
,
'unpublished'
,
'unpublished'
,
0
),
(
'active'
,
'unpublished'
,
'unpublished'
,
1
),
...
...
common/djangoapps/student/views.py
View file @
c68af9d2
...
...
@@ -581,7 +581,7 @@ def dashboard(request):
# program-related information on the dashboard view.
course_programs
=
{}
if
is_student_dashboard_programs_enabled
():
course_programs
=
_get_course_programs
(
user
,
show_courseware_links_for
)
course_programs
=
_get_course_programs
(
user
,
[
enrollment
.
course_id
for
enrollment
in
course_enrollments
]
)
# Construct a dictionary of course mode information
# used to render the course list. We re-use the course modes dict
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment