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
5e67d1dc
Commit
5e67d1dc
authored
Mar 11, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename get_submission_by_uuid to differentiate from get_submission
parent
61ab534b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
apps/openassessment/assessment/self_api.py
+2
-2
apps/submissions/api.py
+2
-2
apps/submissions/tests/test_api.py
+3
-3
No files found.
apps/openassessment/assessment/self_api.py
View file @
5e67d1dc
...
@@ -3,7 +3,7 @@ Public interface for self-assessment.
...
@@ -3,7 +3,7 @@ Public interface for self-assessment.
"""
"""
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
from
submissions.api
import
(
from
submissions.api
import
(
get_submission_
by_uuid
,
get_submissions
,
get_submission_
and_student
,
get_submissions
,
SubmissionNotFoundError
,
SubmissionRequestError
SubmissionNotFoundError
,
SubmissionRequestError
)
)
from
openassessment.assessment.serializers
import
(
from
openassessment.assessment.serializers
import
(
...
@@ -52,7 +52,7 @@ def create_assessment(submission_uuid, user_id, options_selected, rubric_dict, s
...
@@ -52,7 +52,7 @@ def create_assessment(submission_uuid, user_id, options_selected, rubric_dict, s
# Check that the student is allowed to assess this submission
# Check that the student is allowed to assess this submission
try
:
try
:
submission
=
get_submission_
by_uuid
(
submission_uuid
)
submission
=
get_submission_
and_student
(
submission_uuid
)
if
submission
is
None
or
submission
[
'student_item'
][
'student_id'
]
!=
user_id
:
if
submission
is
None
or
submission
[
'student_item'
][
'student_id'
]
!=
user_id
:
raise
SelfAssessmentRequestError
(
_
(
"Cannot self-assess this submission"
))
raise
SelfAssessmentRequestError
(
_
(
"Cannot self-assess this submission"
))
except
SubmissionNotFoundError
:
except
SubmissionNotFoundError
:
...
...
apps/submissions/api.py
View file @
5e67d1dc
...
@@ -192,9 +192,9 @@ def get_submission(submission_uuid):
...
@@ -192,9 +192,9 @@ def get_submission(submission_uuid):
return
SubmissionSerializer
(
submission
)
.
data
return
SubmissionSerializer
(
submission
)
.
data
def
get_submission_
by_uuid
(
uuid
):
def
get_submission_
and_student
(
uuid
):
"""
"""
Retrieve a submission by its unique identifier.
Retrieve a submission by its unique identifier
, including the associated student item
.
Args:
Args:
uuid (str): the unique identifier of the submission.
uuid (str): the unique identifier of the submission.
...
...
apps/submissions/tests/test_api.py
View file @
5e67d1dc
...
@@ -41,15 +41,15 @@ class TestSubmissionsApi(TestCase):
...
@@ -41,15 +41,15 @@ class TestSubmissionsApi(TestCase):
student_item
=
self
.
_get_student_item
(
STUDENT_ITEM
)
student_item
=
self
.
_get_student_item
(
STUDENT_ITEM
)
self
.
_assert_submission
(
submission
,
ANSWER_ONE
,
student_item
.
pk
,
1
)
self
.
_assert_submission
(
submission
,
ANSWER_ONE
,
student_item
.
pk
,
1
)
def
test_get_submission_
by_uuid
(
self
):
def
test_get_submission_
and_student
(
self
):
submission
=
api
.
create_submission
(
STUDENT_ITEM
,
ANSWER_ONE
)
submission
=
api
.
create_submission
(
STUDENT_ITEM
,
ANSWER_ONE
)
# Retrieve the submission by its uuid
# Retrieve the submission by its uuid
retrieved
=
api
.
get_submission_
by_uuid
(
submission
[
'uuid'
])
retrieved
=
api
.
get_submission_
and_student
(
submission
[
'uuid'
])
self
.
assertItemsEqual
(
submission
,
retrieved
)
self
.
assertItemsEqual
(
submission
,
retrieved
)
# Should get None if we retrieve a submission that doesn't exist
# Should get None if we retrieve a submission that doesn't exist
retrieved
=
api
.
get_submission_
by_uuid
(
u'no such uuid'
)
retrieved
=
api
.
get_submission_
and_student
(
u'no such uuid'
)
self
.
assertIs
(
retrieved
,
None
)
self
.
assertIs
(
retrieved
,
None
)
def
test_get_submissions
(
self
):
def
test_get_submissions
(
self
):
...
...
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