Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
df236160
Unverified
Commit
df236160
authored
6 years ago
by
Gregory Martin
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #18613 from edx/yro/LEARNER-5556
Update entitlement ordering in dash
parents
d2c142cc
0b7dbeb5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/student/tests/test_views.py
+42
-6
42 additions, 6 deletions
common/djangoapps/student/tests/test_views.py
common/djangoapps/student/views/dashboard.py
+3
-2
3 additions, 2 deletions
common/djangoapps/student/views/dashboard.py
with
45 additions
and
8 deletions
common/djangoapps/student/tests/test_views.py
+
42
−
6
View file @
df236160
...
...
@@ -700,6 +700,21 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin,
course_run
=
course_run_string
)
@staticmethod
def
_get_html_for_entitlement_button
(
course_key_string
):
return
'''
<div class=
"
course-info
"
>
<span class=
"
info-university
"
>{org} - </span>
<span class=
"
info-course-id
"
>{course}</span>
<span class=
"
info-date-block-container
"
>
<button class=
"
change-session btn-link
"
>Change or Leave Session</button>
</span>
</div>
'''
.
format
(
org
=
course_key_string
.
split
(
'
/
'
)[
0
],
course
=
course_key_string
.
split
(
'
/
'
)[
1
]
)
def
test_view_course_appears_on_dashboard
(
self
):
"""
When a course doesn
'
t have completion data, its course card should
...
...
@@ -813,8 +828,10 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin,
html_for_view_buttons
=
[]
html_for_resume_buttons
=
[]
html_for_entitlement
=
[]
for
i
in
range
(
num_course_cards
):
course
=
CourseFactory
.
create
()
course_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
user
,
...
...
@@ -823,9 +840,14 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin,
course_key
=
course_enrollment
.
course_id
course_key_string
=
str
(
course_key
)
last_completed_block_string
=
''
course_run_string
=
self
.
_pull_course_run_from_course_key
(
course_key_string
)
if
i
==
1
:
CourseEntitlementFactory
.
create
(
user
=
self
.
user
,
enrollment_course_run
=
course_enrollment
)
else
:
last_completed_block_string
=
''
course_run_string
=
self
.
_pull_course_run_from_course_key
(
course_key_string
)
# Submit completed course blocks in even-numbered courses.
if
isEven
(
i
):
...
...
@@ -854,6 +876,11 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin,
course_run_string
)
)
html_for_entitlement
.
append
(
self
.
_get_html_for_entitlement_button
(
course_key_string
)
)
response
=
self
.
client
.
get
(
reverse
(
'
dashboard
'
))
...
...
@@ -865,18 +892,27 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin,
self
.
_remove_whitespace_from_html_string
(
button
)
for
button
in
html_for_resume_buttons
]
html_for_entitlement
=
[
self
.
_remove_whitespace_from_html_string
(
button
)
for
button
in
html_for_entitlement
]
dashboard_html
=
self
.
_remove_whitespace_from_html_string
(
response
.
content
)
for
i
in
range
(
num_course_cards
):
expected_button
=
None
unexpected_button
=
None
if
isEven
(
i
):
if
i
==
1
:
expected_button
=
html_for_entitlement
[
i
]
unexpected_button
=
html_for_view_buttons
[
i
]
+
html_for_resume_buttons
[
i
]
elif
isEven
(
i
):
expected_button
=
html_for_resume_buttons
[
i
]
unexpected_button
=
html_for_view_buttons
[
i
]
unexpected_button
=
html_for_view_buttons
[
i
]
+
html_for_entitlement
[
i
]
else
:
expected_button
=
html_for_view_buttons
[
i
]
unexpected_button
=
html_for_resume_buttons
[
i
]
unexpected_button
=
html_for_resume_buttons
[
i
]
+
html_for_entitlement
[
i
]
self
.
assertIn
(
expected_button
,
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/student/views/dashboard.py
+
3
−
2
View file @
df236160
...
...
@@ -837,10 +837,11 @@ def student_dashboard(request):
})
# Gather urls for course card resume buttons.
resume_button_urls
=
_get_urls_for_resume_buttons
(
user
,
course_enrollments
)
resume_button_urls
=
[
''
for
entitlement
in
course_entitlements
]
for
url
in
_get_urls_for_resume_buttons
(
user
,
course_enrollments
):
resume_button_urls
.
append
(
url
)
# There must be enough urls for dashboard.html. Template creates course
# cards for "enrollments + entitlements".
resume_button_urls
+=
[
''
for
entitlement
in
course_entitlements
]
context
.
update
({
'
resume_button_urls
'
:
resume_button_urls
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment