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
42833184
Commit
42833184
authored
Mar 09, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement self_api.is_complete() to hook self-assessment into the workflow api
parent
4d2b35d2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
9 deletions
+37
-9
apps/openassessment/assessment/self_api.py
+12
-2
apps/openassessment/assessment/test/test_peer.py
+5
-3
apps/openassessment/assessment/test/test_self.py
+10
-1
apps/openassessment/xblock/test/test_grade.py
+10
-3
No files found.
apps/openassessment/assessment/self_api.py
View file @
42833184
...
...
@@ -144,6 +144,16 @@ def get_submission_and_assessment(student_item_dict):
return
(
submissions
[
0
],
None
)
# TODO: fill in this stub
def
is_complete
(
submission_uuid
):
return
True
"""
Check whether a self-assessment has been completed for a submission.
Args:
submission_uuid (str): The unique identifier of the submission.
Returns:
bool
"""
return
Assessment
.
objects
.
filter
(
score_type
=
SELF_TYPE
,
submission__uuid
=
submission_uuid
)
.
exists
()
apps/openassessment/assessment/test/test_peer.py
View file @
42833184
...
...
@@ -217,9 +217,11 @@ class TestPeerApi(TestCase):
)
# Tim has met the critera, and should now have a score.
score
=
workflow_api
.
get_workflow_for_submission
(
tim
[
"uuid"
],
requirements
)[
"score"
]
# We patch the call to `self_api.is_complete()` simulate having completed a self-assessment.
with
patch
(
'openassessment.workflow.models.self_api.is_complete'
)
as
mock_complete
:
mock_complete
.
return_value
=
True
score
=
workflow_api
.
get_workflow_for_submission
(
tim
[
"uuid"
],
requirements
)[
"score"
]
self
.
assertEqual
(
score
[
"points_earned"
],
6
)
self
.
assertEqual
(
score
[
"points_possible"
],
14
)
...
...
apps/openassessment/assessment/test/test_self.py
View file @
42833184
...
...
@@ -9,7 +9,7 @@ import pytz
from
django.test
import
TestCase
from
submissions.api
import
create_submission
from
openassessment.assessment.self_api
import
(
create_assessment
,
get_submission_and_assessment
,
create_assessment
,
get_submission_and_assessment
,
is_complete
,
SelfAssessmentRequestError
)
...
...
@@ -62,6 +62,7 @@ class TestSelfApi(TestCase):
received_submission
,
assessment
=
get_submission_and_assessment
(
self
.
STUDENT_ITEM
)
self
.
assertItemsEqual
(
received_submission
,
submission
)
self
.
assertIs
(
assessment
,
None
)
self
.
assertFalse
(
is_complete
(
submission
[
'uuid'
]))
# Create a self-assessment for the submission
assessment
=
create_assessment
(
...
...
@@ -70,6 +71,9 @@ class TestSelfApi(TestCase):
scored_at
=
datetime
.
datetime
(
2014
,
4
,
1
)
.
replace
(
tzinfo
=
pytz
.
utc
)
)
# Self-assessment should be complete
self
.
assertTrue
(
is_complete
(
submission
[
'uuid'
]))
# Retrieve the self-assessment
received_submission
,
retrieved
=
get_submission_and_assessment
(
self
.
STUDENT_ITEM
)
self
.
assertItemsEqual
(
received_submission
,
submission
)
...
...
@@ -194,3 +198,7 @@ class TestSelfApi(TestCase):
# Expect that we still have the original assessment
_
,
retrieved
=
get_submission_and_assessment
(
self
.
STUDENT_ITEM
)
self
.
assertItemsEqual
(
assessment
,
retrieved
)
def
test_is_complete_no_submission
(
self
):
# This submission uuid does not exist
self
.
assertFalse
(
is_complete
(
'abc1234'
))
\ No newline at end of file
apps/openassessment/xblock/test/test_grade.py
View file @
42833184
...
...
@@ -4,7 +4,7 @@ Tests for grade handlers in Open Assessment XBlock.
"""
import
copy
import
json
from
openassessment.assessment
import
peer_api
from
openassessment.assessment
import
peer_api
,
self_api
from
submissions
import
api
as
sub_api
from
.base
import
XBlockHandlerTestCase
,
scenario
...
...
@@ -48,12 +48,19 @@ class TestGrade(XBlockHandlerTestCase):
)
# Have our user make assessments (so she can get a score)
for
s
ubmission
in
scorer_submissions
:
for
s
corer_sub
in
scorer_submissions
:
peer_api
.
create_assessment
(
s
ubmission
[
'uuid'
],
'Greggs'
,
2
,
2
,
s
corer_sub
[
'uuid'
],
'Greggs'
,
2
,
2
,
self
.
ASSESSMENTS
[
0
],
{
'criteria'
:
xblock
.
rubric_criteria
}
)
# Have the user submit a self-assessment (so she can get a score)
self_api
.
create_assessment
(
submission
[
'uuid'
],
'Greggs'
,
self
.
ASSESSMENTS
[
0
][
'options_selected'
],
{
'criteria'
:
xblock
.
rubric_criteria
}
)
# Render the view
resp
=
self
.
request
(
xblock
,
'render_grade'
,
json
.
dumps
(
dict
()))
...
...
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