Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-submissions
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-submissions
Commits
c724f314
Commit
c724f314
authored
Jul 16, 2014
by
Andrew Dekker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Single query fix
parent
100c1961
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
5 deletions
+2
-5
submissions/api.py
+1
-1
submissions/tests/test_api.py
+1
-4
No files found.
submissions/api.py
View file @
c724f314
...
...
@@ -381,7 +381,7 @@ def get_top_submissions(course_id, item_id, item_type, number_of_top_scores):
student_item__course_id
=
course_id
,
student_item__item_id
=
item_id
,
student_item__item_type
=
item_type
,
)
.
order_by
(
"-points_earned"
)[:
number_of_top_scores
]
)
.
select_related
(
"submission"
)
.
order_by
(
"-points_earned"
)[:
number_of_top_scores
]
except
DatabaseError
:
msg
=
u"Could not fetch top scores for course {}, item {} of type {}"
.
format
(
course_id
,
item_id
,
item_type
...
...
submissions/tests/test_api.py
View file @
c724f314
...
...
@@ -298,9 +298,8 @@ class TestSubmissionsApi(TestCase):
api
.
set_score
(
student_3
[
'uuid'
],
2
,
10
)
#Get top scores works correctly
with
self
.
assertNumQueries
(
4
):
with
self
.
assertNumQueries
(
1
):
top_scores
=
api
.
get_top_submissions
(
student_item
[
"course_id"
],
student_item
[
"item_id"
],
"Peer_Submission"
,
3
)
print
top_scores
self
.
assertEqual
(
top_scores
,
[
...
...
@@ -321,7 +320,6 @@ class TestSubmissionsApi(TestCase):
#Fewer top scores available than the number requested.
top_scores
=
api
.
get_top_submissions
(
student_item
[
"course_id"
],
student_item
[
"item_id"
],
"Peer_Submission"
,
10
)
print
top_scores
self
.
assertEqual
(
top_scores
,
[
...
...
@@ -342,7 +340,6 @@ class TestSubmissionsApi(TestCase):
#More top scores available than the number requested.
top_scores
=
api
.
get_top_submissions
(
student_item
[
"course_id"
],
student_item
[
"item_id"
],
"Peer_Submission"
,
2
)
print
top_scores
self
.
assertEqual
(
top_scores
,
[
...
...
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