Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-data-api
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-data-api
Commits
08e412bf
Commit
08e412bf
authored
Dec 23, 2015
by
Dennis Jen
Committed by
Daniel Friedman
Apr 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added review comments
parent
09c0c280
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
analytics_data_api/v0/models.py
+8
-9
No files found.
analytics_data_api/v0/models.py
View file @
08e412bf
...
@@ -269,7 +269,7 @@ class RosterEntry(DocType):
...
@@ -269,7 +269,7 @@ class RosterEntry(DocType):
Raises `ValueError` if both `segments` and `ignore_segments` are provided.
Raises `ValueError` if both `segments` and `ignore_segments` are provided.
"""
"""
if
sort_policies
is
None
or
len
(
sort_policies
)
==
0
:
if
not
sort_policies
:
sort_policies
=
[{
sort_policies
=
[{
'order_by'
:
None
,
'order_by'
:
None
,
'sort_order'
:
None
'sort_order'
:
None
...
@@ -320,17 +320,16 @@ class RosterEntry(DocType):
...
@@ -320,17 +320,16 @@ class RosterEntry(DocType):
search
.
query
.
must
.
append
(
Q
(
'multi_match'
,
query
=
text_search
,
fields
=
[
'name'
,
'username'
,
'email'
]))
search
.
query
.
must
.
append
(
Q
(
'multi_match'
,
query
=
text_search
,
fields
=
[
'name'
,
'username'
,
'email'
]))
# construct the sort hierarchy
# construct the sort hierarchy
sort_terms
=
[]
search
=
search
.
sort
(
*
[
for
sort_policy
in
sort_policies
:
{
sort_order
=
sort_policy
[
'sort_order'
]
term
=
{
sort_policy
[
'order_by'
]:
{
sort_policy
[
'order_by'
]:
{
'order'
:
sort_order
,
'order'
:
sort_policy
[
'sort_order'
],
'missing'
:
'_last'
if
sort_order
==
'asc'
else
'_first'
,
# ordering of missing fields
# ordering of missing fields
'missing'
:
'_last'
if
sort_policy
[
'sort_order'
]
==
'asc'
else
'_first'
}
}
}
}
sort_terms
.
append
(
term
)
for
sort_policy
in
sort_policies
search
=
search
.
sort
(
*
sort_terms
)
]
)
return
search
return
search
...
...
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