Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-dashboard
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-analytics-dashboard
Commits
ed2d3117
Commit
ed2d3117
authored
Mar 03, 2015
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #270 from edx/sorting-fix
Fixed Sorting Bug on Course Index Page
parents
3c2492cb
d6eb99f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
analytics_dashboard/courses/tests/test_views/test_pages.py
+2
-1
analytics_dashboard/courses/views/__init__.py
+2
-1
No files found.
analytics_dashboard/courses/tests/test_views/test_pages.py
View file @
ed2d3117
...
@@ -34,7 +34,7 @@ class CourseIndexViewTests(CourseAPIMixin, ViewTestMixin, MiddlewareAssertionMix
...
@@ -34,7 +34,7 @@ class CourseIndexViewTests(CourseAPIMixin, ViewTestMixin, MiddlewareAssertionMix
def
setUp
(
self
):
def
setUp
(
self
):
super
(
CourseIndexViewTests
,
self
)
.
setUp
()
super
(
CourseIndexViewTests
,
self
)
.
setUp
()
self
.
grant_permission
(
self
.
user
,
DEMO_COURSE_ID
,
DEPRECATED_DEMO_COURSE_ID
)
self
.
grant_permission
(
self
.
user
,
DEMO_COURSE_ID
,
DEPRECATED_DEMO_COURSE_ID
)
self
.
courses
=
self
.
_create_course_list
(
DE
MO_COURSE_ID
,
DEPRECATED_
DEMO_COURSE_ID
)
self
.
courses
=
self
.
_create_course_list
(
DE
PRECATED_DEMO_COURSE_ID
,
DEMO_COURSE_ID
)
def
assertCourseListEquals
(
self
,
courses
):
def
assertCourseListEquals
(
self
,
courses
):
response
=
self
.
client
.
get
(
self
.
path
())
response
=
self
.
client
.
get
(
self
.
path
())
...
@@ -47,6 +47,7 @@ class CourseIndexViewTests(CourseAPIMixin, ViewTestMixin, MiddlewareAssertionMix
...
@@ -47,6 +47,7 @@ class CourseIndexViewTests(CourseAPIMixin, ViewTestMixin, MiddlewareAssertionMix
def
test_get
(
self
):
def
test_get
(
self
):
""" If the user is authorized, the view should return a list of all accessible courses. """
""" If the user is authorized, the view should return a list of all accessible courses. """
self
.
courses
.
sort
(
key
=
lambda
course
:
(
course
[
'name'
]
or
course
[
'key'
]
or
''
)
.
lower
())
self
.
assertCourseListEquals
(
self
.
courses
)
self
.
assertCourseListEquals
(
self
.
courses
)
def
test_get_with_mixed_permissions
(
self
):
def
test_get_with_mixed_permissions
(
self
):
...
...
analytics_dashboard/courses/views/__init__.py
View file @
ed2d3117
...
@@ -522,7 +522,6 @@ class CourseIndex(CourseAPIMixin, LoginRequiredMixin, TrackedViewMixin, LazyEnco
...
@@ -522,7 +522,6 @@ class CourseIndex(CourseAPIMixin, LoginRequiredMixin, TrackedViewMixin, LazyEnco
raise
PermissionDenied
raise
PermissionDenied
courses
=
self
.
_create_course_list
(
courses
)
courses
=
self
.
_create_course_list
(
courses
)
courses
=
sorted
(
courses
,
key
=
lambda
course
:
course
.
get
(
'name'
,
course
.
get
(
'key'
)))
context
[
'courses'
]
=
courses
context
[
'courses'
]
=
courses
context
[
'page_data'
]
=
self
.
get_page_data
(
context
)
context
[
'page_data'
]
=
self
.
get_page_data
(
context
)
...
@@ -544,4 +543,6 @@ class CourseIndex(CourseAPIMixin, LoginRequiredMixin, TrackedViewMixin, LazyEnco
...
@@ -544,4 +543,6 @@ class CourseIndex(CourseAPIMixin, LoginRequiredMixin, TrackedViewMixin, LazyEnco
for
course_id
in
course_ids
:
for
course_id
in
course_ids
:
info
.
append
({
'key'
:
course_id
,
'name'
:
course_data
.
get
(
course_id
)})
info
.
append
({
'key'
:
course_id
,
'name'
:
course_data
.
get
(
course_id
)})
info
.
sort
(
key
=
lambda
course
:
(
course
.
get
(
'name'
,
''
)
or
course
.
get
(
'key'
,
''
)
or
''
)
.
lower
())
return
info
return
info
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