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
a73c688f
Commit
a73c688f
authored
Jul 15, 2014
by
Andrew Dekker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored database call for top submissions
parent
97bb11d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
submissions/api.py
+5
-6
No files found.
submissions/api.py
View file @
a73c688f
...
...
@@ -377,11 +377,11 @@ def get_top_submissions(course_id, item_id, item_type, number_of_top_scores):
logger
.
exception
(
error_msg
)
raise
SubmissionRequestError
(
error_msg
)
try
:
s
tudent_item_models
=
StudentItem
.
objects
.
filter
(
course_id
=
course_id
,
item_id
=
item_id
,
item_type
=
item_type
)
s
cores
=
Score
.
objects
.
filter
(
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
]
except
DatabaseError
:
msg
=
u"Could not fetch top scores for course {}, item {} of type {}"
.
format
(
course_id
,
item_id
,
item_type
...
...
@@ -389,7 +389,6 @@ def get_top_submissions(course_id, item_id, item_type, number_of_top_scores):
logger
.
exception
(
msg
)
raise
SubmissionNotFoundError
(
msg
)
topsubmissions
=
[]
scores
=
Score
.
objects
.
filter
(
student_item
=
student_item_models
)
.
order_by
(
"-points_earned"
)[:
number_of_top_scores
]
for
score
in
scores
:
answer
=
SubmissionSerializer
(
score
.
submission
)
.
data
[
'answer'
]
topsubmissions
.
append
({
'score'
:
score
.
points_earned
,
'content'
:
answer
})
...
...
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