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
b11bb68d
Commit
b11bb68d
authored
Nov 13, 2015
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
714708d8
' into andya/ora-staff-grading-with-backend
parents
c3c3ddb6
714708d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
21 deletions
+20
-21
openassessment/assessment/api/staff.py
+14
-15
openassessment/assessment/test/test_staff.py
+1
-1
openassessment/xblock/test/test_staff.py
+5
-5
No files found.
openassessment/assessment/api/staff.py
View file @
b11bb68d
...
...
@@ -21,7 +21,6 @@ from submissions import api as sub_api
logger
=
logging
.
getLogger
(
"openassessment.assessment.api.staff"
)
STAFF_TYPE
=
"ST"
...
...
@@ -55,7 +54,7 @@ def assessment_is_finished(submission_uuid, requirements):
"""
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
...
...
@@ -74,7 +73,7 @@ def get_score(submission_uuid, requirements):
contributing_assessments, and staff_id information.
"""
assessment
=
get_latest_assessment
(
submission_uuid
)
assessment
=
get_latest_
staff_
assessment
(
submission_uuid
)
if
not
assessment
:
return
None
...
...
@@ -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.
...
...
@@ -102,7 +101,7 @@ def get_latest_assessment(submission_uuid):
Example usage:
>>> get_latest_assessment('10df7db776686822e501b05f452dc1e4b9141fe5')
>>> get_latest_
staff_
assessment('10df7db776686822e501b05f452dc1e4b9141fe5')
{
'points_earned': 6,
'points_possible': 12,
...
...
@@ -132,7 +131,7 @@ def get_latest_assessment(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:
submission_uuid (str): The submission uuid is used to get the
...
...
@@ -221,13 +220,13 @@ def create_assessment(
return
full_assessment_dict
(
assessment
)
except
InvalidRubric
:
msg
=
u"Rubric definition was not valid"
logger
.
exception
(
msg
)
raise
StaffAssessmentRequestError
(
msg
)
error_message
=
u"Rubric definition was not valid"
logger
.
exception
(
error_message
)
raise
StaffAssessmentRequestError
(
error_message
)
except
InvalidRubricSelection
:
msg
=
u"Invalid options selected in the rubric"
logger
.
warning
(
msg
,
exc_info
=
True
)
raise
StaffAssessmentRequestError
(
msg
)
error_message
=
u"Invalid options selected in the rubric"
logger
.
warning
(
error_message
,
exc_info
=
True
)
raise
StaffAssessmentRequestError
(
error_message
)
except
DatabaseError
:
error_message
=
(
u"An error occurred while creating assessment by scorer with ID: {}"
...
...
@@ -251,11 +250,10 @@ def _complete_assessment(
in a single transaction.
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
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
option names the user selected for that criterion.
criterion_feedback (dict): Dictionary mapping criterion names to the
...
...
@@ -263,6 +261,7 @@ def _complete_assessment(
Since criterion feedback is optional, some criteria may not appear
in the dictionary.
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
the assessment took place. If not specified, scored_at is set to
now.
...
...
openassessment/assessment/test/test_staff.py
View file @
b11bb68d
...
...
@@ -260,7 +260,7 @@ class TestStaffOverwrite(CacheResetTest):
# Try to get the latest staff assessment, handle database errors
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
(
str
(
context_manager
.
exception
),
(
...
...
openassessment/xblock/test/test_staff.py
View file @
b11bb68d
...
...
@@ -42,7 +42,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
self
.
assertTrue
(
resp
[
'success'
])
# 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
[
'points_earned'
],
5
)
self
.
assertEqual
(
assessment
[
'points_possible'
],
6
)
...
...
@@ -67,7 +67,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
self
.
assertEqual
(
assessment
[
'points_possible'
],
score
[
'points_possible'
])
@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
student_item
=
xblock
.
get_student_item_dict
()
xblock
.
create_submission
(
student_item
,
self
.
SUBMISSION
)
...
...
@@ -75,7 +75,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
self
.
assertIn
(
"You do not have permission"
,
resp
)
@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
()
# Create a submission for the student
...
...
@@ -92,7 +92,7 @@ class TestStaffAssessment(StaffAssessmentTestBase):
self
.
assertIn
(
'msg'
,
resp
)
@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
()
# Create a submission for the student
...
...
@@ -115,7 +115,7 @@ class TestStaffAssessment(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'
)
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