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
d39a51a1
Commit
d39a51a1
authored
Feb 27, 2015
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7138 from edx/clintonb/cs-sorting-fix
Fixed Sorting Bug
parents
8b81dca0
59b4b649
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
lms/djangoapps/course_structure_api/v0/tests.py
+4
-1
lms/djangoapps/course_structure_api/v0/views.py
+1
-2
No files found.
lms/djangoapps/course_structure_api/v0/tests.py
View file @
d39a51a1
...
...
@@ -11,6 +11,7 @@ from mock import patch, Mock
from
oauth2_provider.tests.factories
import
AccessTokenFactory
,
ClientFactory
from
opaque_keys.edx.locator
import
CourseLocator
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.xml
import
CourseLocationManager
...
...
@@ -77,7 +78,9 @@ class CourseViewTestsMixin(object):
self
.
empty_course
=
CourseFactory
.
create
(
start
=
datetime
(
2014
,
6
,
16
,
14
,
30
),
end
=
datetime
(
2015
,
1
,
16
),
org
=
"MTD"
org
=
"MTD"
,
# Use mongo so that we can get a test with a SlashSeparatedCourseKey
default_store
=
ModuleStoreEnum
.
Type
.
mongo
)
def
build_absolute_url
(
self
,
path
=
None
):
...
...
lms/djangoapps/course_structure_api/v0/views.py
View file @
d39a51a1
""" API implementation for course-oriented interactions. """
import
logging
from
operator
import
attrgetter
from
django.conf
import
settings
from
django.http
import
Http404
...
...
@@ -132,7 +131,7 @@ class CourseList(CourseViewMixin, ListAPIView):
results
=
(
course
for
course
in
results
if
self
.
user_can_access_course
(
self
.
request
.
user
,
course
))
# Sort the results in a predictable manner.
return
sorted
(
results
,
key
=
attrgetter
(
'id'
))
return
sorted
(
results
,
key
=
lambda
course
:
unicode
(
course
.
id
))
class
CourseDetail
(
CourseViewMixin
,
RetrieveAPIView
):
...
...
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