Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
95e1a581
Commit
95e1a581
authored
Feb 27, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error when rendering XBlock in preview
parent
be916197
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
apps/submissions/api.py
+7
-2
apps/submissions/tests/test_api.py
+7
-2
No files found.
apps/submissions/api.py
View file @
95e1a581
...
...
@@ -252,8 +252,13 @@ def get_score(student_item):
}]
"""
student_item_model
=
StudentItem
.
objects
.
get
(
**
student_item
)
scores
=
Score
.
objects
.
filter
(
student_item
=
student_item_model
)
try
:
student_item_model
=
StudentItem
.
objects
.
get
(
**
student_item
)
scores
=
Score
.
objects
.
filter
(
student_item
=
student_item_model
)
except
StudentItem
.
DoesNotExist
:
return
None
return
ScoreSerializer
(
scores
,
many
=
True
)
.
data
...
...
apps/submissions/tests/test_api.py
View file @
95e1a581
import
datetime
import
copy
from
ddt
import
ddt
,
file_data
from
django.db
import
DatabaseError
...
...
@@ -134,6 +135,11 @@ class TestApi(TestCase):
scores
=
api
.
get_score
(
STUDENT_ITEM
)
self
.
_assert_score
(
scores
[
0
],
11
,
12
)
def
test_get_score_no_student_id
(
self
):
student_item
=
copy
.
deepcopy
(
STUDENT_ITEM
)
student_item
[
'student_id'
]
=
None
self
.
assertIs
(
api
.
get_score
(
student_item
),
None
)
def
_assert_score
(
self
,
score
,
...
...
@@ -141,4 +147,4 @@ class TestApi(TestCase):
expected_points_possible
):
self
.
assertIsNotNone
(
score
)
self
.
assertEqual
(
score
[
"points_earned"
],
expected_points_earned
)
self
.
assertEqual
(
score
[
"points_possible"
],
expected_points_possible
)
\ No newline at end of file
self
.
assertEqual
(
score
[
"points_possible"
],
expected_points_possible
)
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