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
e32ff53f
Unverified
Commit
e32ff53f
authored
Dec 18, 2017
by
Michael Terry
Committed by
GitHub
Dec 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16935 from edx/mikix/expired-rel-programs
Show programs for expired entitlements
parents
6ea32b7a
4fe60eb1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
7 deletions
+20
-7
common/djangoapps/student/tests/test_views.py
+18
-4
lms/templates/dashboard.html
+1
-1
openedx/core/djangoapps/programs/utils.py
+0
-1
themes/edx.org/lms/templates/dashboard.html
+1
-1
No files found.
common/djangoapps/student/tests/test_views.py
View file @
e32ff53f
...
...
@@ -395,16 +395,18 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
self
.
assertIn
(
'You can no longer select a session'
,
response
.
content
)
self
.
assertNotIn
(
'<div class="course-entitlement-selection-container ">'
,
response
.
content
)
@patch
(
'openedx.core.djangoapps.programs.utils.get_programs'
)
@patch
(
'student.views.get_course_runs_for_course'
)
@patch.object
(
CourseOverview
,
'get_from_id'
)
@patch
(
'opaque_keys.edx.keys.CourseKey.from_string'
)
def
test_fulfilled_entitlement
(
self
,
mock_course_key
,
mock_course_overview
,
mock_course_runs
):
def
test_fulfilled_entitlement
(
self
,
mock_course_key
,
mock_course_overview
,
mock_course_runs
,
mock_get_programs
):
"""
When a learner has a fulfilled entitlement, their course dashboard should have:
- exactly one course item, meaning it:
- has an entitlement card
- does NOT have a course card referencing the selected session
- an unhidden Change Session button
- a related programs message
"""
mocked_course_overview
=
CourseOverviewFactory
(
start
=
self
.
TOMORROW
,
self_paced
=
True
,
enrollment_end
=
self
.
TOMORROW
...
...
@@ -420,20 +422,27 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
'type'
:
'verified'
}
]
CourseEntitlementFactory
(
user
=
self
.
user
,
enrollment_course_run
=
course_enrollment
)
entitlement
=
CourseEntitlementFactory
(
user
=
self
.
user
,
enrollment_course_run
=
course_enrollment
)
program
=
ProgramFactory
()
program
[
'courses'
][
0
][
'course_runs'
]
=
[{
'key'
:
unicode
(
mocked_course_overview
.
id
)}]
program
[
'courses'
][
0
][
'uuid'
]
=
entitlement
.
course_uuid
mock_get_programs
.
return_value
=
[
program
]
response
=
self
.
client
.
get
(
self
.
path
)
self
.
assertEqual
(
response
.
content
.
count
(
'<li class="course-item">'
),
1
)
self
.
assertIn
(
'<button class="change-session btn-link "'
,
response
.
content
)
self
.
assertIn
(
'Related Programs:'
,
response
.
content
)
@patch
(
'openedx.core.djangoapps.programs.utils.get_programs'
)
@patch
(
'student.views.get_course_runs_for_course'
)
@patch.object
(
CourseOverview
,
'get_from_id'
)
@patch
(
'opaque_keys.edx.keys.CourseKey.from_string'
)
def
test_fulfilled_expired_entitlement
(
self
,
mock_course_key
,
mock_course_overview
,
mock_course_runs
):
def
test_fulfilled_expired_entitlement
(
self
,
mock_course_key
,
mock_course_overview
,
mock_course_runs
,
mock_get_programs
):
"""
When a learner has a fulfilled entitlement that is expired, their course dashboard should have:
- exactly one course item, meaning it:
- has an entitlement card
- Message that the learner can no longer change sessions
- a related programs message
"""
mocked_course_overview
=
CourseOverviewFactory
(
start
=
self
.
TOMORROW
,
self_paced
=
True
,
enrollment_end
=
self
.
TOMORROW
...
...
@@ -449,10 +458,15 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
'type'
:
'verified'
}
]
CourseEntitlementFactory
(
user
=
self
.
user
,
enrollment_course_run
=
course_enrollment
,
created
=
self
.
THREE_YEARS_AGO
)
entitlement
=
CourseEntitlementFactory
(
user
=
self
.
user
,
enrollment_course_run
=
course_enrollment
,
created
=
self
.
THREE_YEARS_AGO
)
program
=
ProgramFactory
()
program
[
'courses'
][
0
][
'course_runs'
]
=
[{
'key'
:
unicode
(
mocked_course_overview
.
id
)}]
program
[
'courses'
][
0
][
'uuid'
]
=
entitlement
.
course_uuid
mock_get_programs
.
return_value
=
[
program
]
response
=
self
.
client
.
get
(
self
.
path
)
self
.
assertEqual
(
response
.
content
.
count
(
'<li class="course-item">'
),
1
)
self
.
assertIn
(
'You can no longer change sessions.'
,
response
.
content
)
self
.
assertIn
(
'Related Programs:'
,
response
.
content
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
...
...
lms/templates/dashboard.html
View file @
e32ff53f
...
...
@@ -176,7 +176,7 @@ from student.models import CourseEnrollment
is_course_blocked =
(session_id
in
block_courses
)
course_verification_status =
verification_status_by_course.get(session_id,
{})
course_requirements =
courses_requirements_not_met.get(session_id)
related_programs =
inverted_programs.get(unicode(entitlement.course_uuid
if
entitlement
else
session_id
))
related_programs =
inverted_programs.get(unicode(entitlement.course_uuid
if
is_unfulfilled_
entitlement
else
session_id
))
show_consent_link =
(session_id
in
consent_required_courses
)
course_overview =
enrollment.course_overview
%
>
...
...
openedx/core/djangoapps/programs/utils.py
View file @
e32ff53f
...
...
@@ -120,7 +120,6 @@ class ProgramProgressMeter(object):
program_list
=
inverted_programs
[
course_uuid
]
if
program
not
in
program_list
:
program_list
.
append
(
program
)
continue
for
course_run
in
course
[
'course_runs'
]:
course_run_id
=
course_run
[
'key'
]
if
course_run_id
in
self
.
course_run_ids
:
...
...
themes/edx.org/lms/templates/dashboard.html
View file @
e32ff53f
...
...
@@ -172,7 +172,7 @@ from student.models import CourseEnrollment
is_course_blocked =
(session_id
in
block_courses
)
course_verification_status =
verification_status_by_course.get(session_id,
{})
course_requirements =
courses_requirements_not_met.get(session_id)
related_programs =
inverted_programs.get(unicode(entitlement.course_uuid
if
entitlement
else
session_id
))
related_programs =
inverted_programs.get(unicode(entitlement.course_uuid
if
is_unfulfilled_
entitlement
else
session_id
))
show_consent_link =
(session_id
in
consent_required_courses
)
course_overview =
enrollment.course_overview
%
>
...
...
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