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
714708d8
Commit
714708d8
authored
Nov 13, 2015
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! TNL-3714, adding backend support for staff scoring
parent
634d3b97
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
22 deletions
+21
-22
openassessment/assessment/api/staff.py
+14
-15
openassessment/assessment/test/test_staff.py
+1
-1
openassessment/workflow/models.py
+1
-1
openassessment/xblock/test/test_staff.py
+5
-5
No files found.
openassessment/assessment/api/staff.py
View file @
714708d8
...
@@ -21,7 +21,6 @@ from submissions import api as sub_api
...
@@ -21,7 +21,6 @@ from submissions import api as sub_api
logger
=
logging
.
getLogger
(
"openassessment.assessment.api.staff"
)
logger
=
logging
.
getLogger
(
"openassessment.assessment.api.staff"
)
STAFF_TYPE
=
"ST"
STAFF_TYPE
=
"ST"
...
@@ -55,7 +54,7 @@ def assessment_is_finished(submission_uuid, requirements):
...
@@ -55,7 +54,7 @@ def assessment_is_finished(submission_uuid, requirements):
"""
"""
if
requirements
and
requirements
.
get
(
'staff'
,
{})
.
get
(
'required'
,
False
):
if
requirements
and
requirements
.
get
(
'staff'
,
{})
.
get
(
'required'
,
False
):
return
bool
(
get_latest_assessment
(
submission_uuid
))
return
bool
(
get_latest_
staff_
assessment
(
submission_uuid
))
return
True
return
True
...
@@ -74,7 +73,7 @@ def get_score(submission_uuid, requirements):
...
@@ -74,7 +73,7 @@ def get_score(submission_uuid, requirements):
contributing_assessments, and staff_id information.
contributing_assessments, and staff_id information.
"""
"""
assessment
=
get_latest_assessment
(
submission_uuid
)
assessment
=
get_latest_
staff_
assessment
(
submission_uuid
)
if
not
assessment
:
if
not
assessment
:
return
None
return
None
...
@@ -86,7 +85,7 @@ def get_score(submission_uuid, requirements):
...
@@ -86,7 +85,7 @@ def get_score(submission_uuid, requirements):
}
}
def
get_latest_assessment
(
submission_uuid
):
def
get_latest_
staff_
assessment
(
submission_uuid
):
"""
"""
Retrieve the latest staff assessment for a submission.
Retrieve the latest staff assessment for a submission.
...
@@ -102,7 +101,7 @@ def get_latest_assessment(submission_uuid):
...
@@ -102,7 +101,7 @@ def get_latest_assessment(submission_uuid):
Example usage:
Example usage:
>>> get_latest_assessment('10df7db776686822e501b05f452dc1e4b9141fe5')
>>> get_latest_
staff_
assessment('10df7db776686822e501b05f452dc1e4b9141fe5')
{
{
'points_earned': 6,
'points_earned': 6,
'points_possible': 12,
'points_possible': 12,
...
@@ -132,7 +131,7 @@ def get_latest_assessment(submission_uuid):
...
@@ -132,7 +131,7 @@ def get_latest_assessment(submission_uuid):
def
get_assessment_scores_by_criteria
(
submission_uuid
):
def
get_assessment_scores_by_criteria
(
submission_uuid
):
"""Get the score for each rubric criterion
"""Get the s
taff s
core for each rubric criterion
Args:
Args:
submission_uuid (str): The submission uuid is used to get the
submission_uuid (str): The submission uuid is used to get the
...
@@ -221,13 +220,13 @@ def create_assessment(
...
@@ -221,13 +220,13 @@ def create_assessment(
return
full_assessment_dict
(
assessment
)
return
full_assessment_dict
(
assessment
)
except
InvalidRubric
:
except
InvalidRubric
:
msg
=
u"Rubric definition was not valid"
error_message
=
u"Rubric definition was not valid"
logger
.
exception
(
msg
)
logger
.
exception
(
error_message
)
raise
StaffAssessmentRequestError
(
msg
)
raise
StaffAssessmentRequestError
(
error_message
)
except
InvalidRubricSelection
:
except
InvalidRubricSelection
:
msg
=
u"Invalid options selected in the rubric"
error_message
=
u"Invalid options selected in the rubric"
logger
.
warning
(
msg
,
exc_info
=
True
)
logger
.
warning
(
error_message
,
exc_info
=
True
)
raise
StaffAssessmentRequestError
(
msg
)
raise
StaffAssessmentRequestError
(
error_message
)
except
DatabaseError
:
except
DatabaseError
:
error_message
=
(
error_message
=
(
u"An error occurred while creating assessment by scorer with ID: {}"
u"An error occurred while creating assessment by scorer with ID: {}"
...
@@ -251,11 +250,10 @@ def _complete_assessment(
...
@@ -251,11 +250,10 @@ def _complete_assessment(
in a single transaction.
in a single transaction.
Args:
Args:
rubric_dict (dict): The rubric model associated with this assessment
scorer_id (str): The user ID for the user giving this assessment. This
is required to create an assessment on a submission.
submission_uuid (str): The submission uuid for the submission being
submission_uuid (str): The submission uuid for the submission being
assessed.
assessed.
scorer_id (str): The user ID for the user giving this assessment. This
is required to create an assessment on a submission.
options_selected (dict): Dictionary mapping criterion names to the
options_selected (dict): Dictionary mapping criterion names to the
option names the user selected for that criterion.
option names the user selected for that criterion.
criterion_feedback (dict): Dictionary mapping criterion names to the
criterion_feedback (dict): Dictionary mapping criterion names to the
...
@@ -263,6 +261,7 @@ def _complete_assessment(
...
@@ -263,6 +261,7 @@ def _complete_assessment(
Since criterion feedback is optional, some criteria may not appear
Since criterion feedback is optional, some criteria may not appear
in the dictionary.
in the dictionary.
overall_feedback (unicode): Free-form text feedback on the submission overall.
overall_feedback (unicode): Free-form text feedback on the submission overall.
rubric_dict (dict): The rubric model associated with this assessment
scored_at (datetime): Optional argument to override the time in which
scored_at (datetime): Optional argument to override the time in which
the assessment took place. If not specified, scored_at is set to
the assessment took place. If not specified, scored_at is set to
now.
now.
...
...
openassessment/assessment/test/test_staff.py
View file @
714708d8
...
@@ -260,7 +260,7 @@ class TestStaffOverwrite(CacheResetTest):
...
@@ -260,7 +260,7 @@ class TestStaffOverwrite(CacheResetTest):
# Try to get the latest staff assessment, handle database errors
# Try to get the latest staff assessment, handle database errors
with
self
.
assertRaises
(
StaffAssessmentInternalError
)
as
context_manager
:
with
self
.
assertRaises
(
StaffAssessmentInternalError
)
as
context_manager
:
staff_api
.
get_latest_assessment
(
tim_sub
[
"uuid"
])
staff_api
.
get_latest_
staff_
assessment
(
tim_sub
[
"uuid"
])
self
.
assertEqual
(
self
.
assertEqual
(
str
(
context_manager
.
exception
),
str
(
context_manager
.
exception
),
(
(
...
...
openassessment/workflow/models.py
View file @
714708d8
...
@@ -377,7 +377,7 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
...
@@ -377,7 +377,7 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
"""
"""
Set a staff score for the workflow.
Set a staff score for the workflow.
Allows for staff scores to be
t
set on a submission, with annotations to provide an audit trail if needed.
Allows for staff scores to be set on a submission, with annotations to provide an audit trail if needed.
This method can be used for both required staff grading, and staff overrides.
This method can be used for both required staff grading, and staff overrides.
Args:
Args:
...
...
openassessment/xblock/test/test_staff.py
View file @
714708d8
...
@@ -42,7 +42,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
...
@@ -42,7 +42,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
self
.
assertTrue
(
resp
[
'success'
])
self
.
assertTrue
(
resp
[
'success'
])
# Expect that a staff-assessment was created
# Expect that a staff-assessment was created
assessment
=
staff_api
.
get_latest_assessment
(
submission
[
'uuid'
])
assessment
=
staff_api
.
get_latest_
staff_
assessment
(
submission
[
'uuid'
])
self
.
assertEqual
(
assessment
[
'submission_uuid'
],
submission
[
'uuid'
])
self
.
assertEqual
(
assessment
[
'submission_uuid'
],
submission
[
'uuid'
])
self
.
assertEqual
(
assessment
[
'points_earned'
],
5
)
self
.
assertEqual
(
assessment
[
'points_earned'
],
5
)
self
.
assertEqual
(
assessment
[
'points_possible'
],
6
)
self
.
assertEqual
(
assessment
[
'points_possible'
],
6
)
...
@@ -67,7 +67,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
...
@@ -67,7 +67,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
self
.
assertEqual
(
assessment
[
'points_possible'
],
score
[
'points_possible'
])
self
.
assertEqual
(
assessment
[
'points_possible'
],
score
[
'points_possible'
])
@scenario
(
'data/self_assessment_scenario.xml'
,
user_id
=
'Bob'
)
@scenario
(
'data/self_assessment_scenario.xml'
,
user_id
=
'Bob'
)
def
test_
staff_assess_
permission_error
(
self
,
xblock
):
def
test_permission_error
(
self
,
xblock
):
# Create a submission for the student
# Create a submission for the student
student_item
=
xblock
.
get_student_item_dict
()
student_item
=
xblock
.
get_student_item_dict
()
xblock
.
create_submission
(
student_item
,
self
.
SUBMISSION
)
xblock
.
create_submission
(
student_item
,
self
.
SUBMISSION
)
...
@@ -75,7 +75,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
...
@@ -75,7 +75,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
self
.
assertIn
(
"You do not have permission"
,
resp
)
self
.
assertIn
(
"You do not have permission"
,
resp
)
@scenario
(
'data/self_assessment_scenario.xml'
,
user_id
=
'Bob'
)
@scenario
(
'data/self_assessment_scenario.xml'
,
user_id
=
'Bob'
)
def
test_
staff_assess_
invalid_options
(
self
,
xblock
):
def
test_invalid_options
(
self
,
xblock
):
student_item
=
xblock
.
get_student_item_dict
()
student_item
=
xblock
.
get_student_item_dict
()
# Create a submission for the student
# Create a submission for the student
...
@@ -92,7 +92,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
...
@@ -92,7 +92,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
self
.
assertIn
(
'msg'
,
resp
)
self
.
assertIn
(
'msg'
,
resp
)
@scenario
(
'data/self_assessment_scenario.xml'
,
user_id
=
'bob'
)
@scenario
(
'data/self_assessment_scenario.xml'
,
user_id
=
'bob'
)
def
test_
staff_assess_
assessment_error
(
self
,
xblock
):
def
test_assessment_error
(
self
,
xblock
):
student_item
=
xblock
.
get_student_item_dict
()
student_item
=
xblock
.
get_student_item_dict
()
# Create a submission for the student
# Create a submission for the student
...
@@ -115,7 +115,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
...
@@ -115,7 +115,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
class
TestStaffAssessmentRender
(
StaffAssessmentTestBase
):
class
TestStaffAssessmentRender
(
StaffAssessmentTestBase
):
#TODO: test success when staff assessment template exists
#
TODO: test success when staff assessment template exists
@scenario
(
'data/self_assessment_scenario.xml'
,
user_id
=
'Bob'
)
@scenario
(
'data/self_assessment_scenario.xml'
,
user_id
=
'Bob'
)
def
test_render_staff_assessment_permission_error
(
self
,
xblock
):
def
test_render_staff_assessment_permission_error
(
self
,
xblock
):
...
...
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