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
c19eb221
Commit
c19eb221
authored
Dec 04, 2015
by
Diana Huang
Committed by
Andy Armstrong
Dec 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add grading statistics to the API.
parent
a3a23a99
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
2 deletions
+87
-2
openassessment/assessment/api/staff.py
+16
-1
openassessment/assessment/models/staff.py
+29
-0
openassessment/assessment/test/test_staff.py
+42
-1
No files found.
openassessment/assessment/api/staff.py
View file @
c19eb221
...
@@ -230,7 +230,8 @@ def get_assessment_scores_by_criteria(submission_uuid):
...
@@ -230,7 +230,8 @@ def get_assessment_scores_by_criteria(submission_uuid):
def
get_submission_to_assess
(
course_id
,
item_id
,
scorer_id
):
def
get_submission_to_assess
(
course_id
,
item_id
,
scorer_id
):
"""Get a submission for staff evaluation.
"""
Get a submission for staff evaluation.
Retrieves a submission for assessment for the given staff member.
Retrieves a submission for assessment for the given staff member.
...
@@ -281,6 +282,20 @@ def get_submission_to_assess(course_id, item_id, scorer_id):
...
@@ -281,6 +282,20 @@ def get_submission_to_assess(course_id, item_id, scorer_id):
return
None
return
None
def
get_staff_grading_statistics
(
course_id
,
item_id
):
"""
Returns the number of graded, ungraded, and in-progress submissions for staff grading.
Args:
course_id (str): The course that this problem belongs to
item_id (str): The student_item (problem) that we want to know statistics about.
Returns:
dict: a dictionary that contains the following keys: 'graded', 'ungraded', and 'in-progress'
"""
return
StaffWorkflow
.
get_workflow_statistics
(
course_id
,
item_id
)
def
create_assessment
(
def
create_assessment
(
submission_uuid
,
submission_uuid
,
scorer_id
,
scorer_id
,
...
...
openassessment/assessment/models/staff.py
View file @
c19eb221
...
@@ -51,6 +51,35 @@ class StaffWorkflow(models.Model):
...
@@ -51,6 +51,35 @@ class StaffWorkflow(models.Model):
return
bool
(
self
.
cancelled_at
)
return
bool
(
self
.
cancelled_at
)
@classmethod
@classmethod
def
get_workflow_statistics
(
cls
,
course_id
,
item_id
):
"""
Returns the number of graded, ungraded, and in-progress submissions for staff grading.
Args:
course_id (str): The course that this problem belongs to
item_id (str): The student_item (problem) that we want to know statistics about.
Returns:
dict: a dictionary that contains the following keys: 'graded', 'ungraded', and 'in-progress'
"""
timeout
=
(
now
()
-
cls
.
TIME_LIMIT
)
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
ungraded
=
cls
.
objects
.
filter
(
models
.
Q
(
grading_started_at
=
None
)
|
models
.
Q
(
grading_started_at__lte
=
timeout
),
course_id
=
course_id
,
item_id
=
item_id
,
grading_completed_at
=
None
,
cancelled_at
=
None
)
.
count
()
in_progress
=
cls
.
objects
.
filter
(
course_id
=
course_id
,
item_id
=
item_id
,
grading_completed_at
=
None
,
cancelled_at
=
None
,
grading_started_at__gt
=
timeout
)
.
count
()
graded
=
cls
.
objects
.
filter
(
course_id
=
course_id
,
item_id
=
item_id
,
cancelled_at
=
None
)
.
exclude
(
grading_completed_at
=
None
)
.
count
()
return
{
'ungraded'
:
ungraded
,
'in-progress'
:
in_progress
,
'graded'
:
graded
}
@classmethod
def
get_submission_for_review
(
cls
,
course_id
,
item_id
,
scorer_id
):
def
get_submission_for_review
(
cls
,
course_id
,
item_id
,
scorer_id
):
"""
"""
Find a submission for staff assessment. This function will find the next
Find a submission for staff assessment. This function will find the next
...
...
openassessment/assessment/test/test_staff.py
View file @
c19eb221
...
@@ -445,7 +445,48 @@ class TestStaffAssessment(CacheResetTest):
...
@@ -445,7 +445,48 @@ class TestStaffAssessment(CacheResetTest):
tim_sub
,
tim
=
self
.
_create_student_and_submission
(
"Tim"
,
"Tim's answer"
)
tim_sub
,
tim
=
self
.
_create_student_and_submission
(
"Tim"
,
"Tim's answer"
)
workflow_api
.
cancel_workflow
(
tim_sub
[
'uuid'
],
"Test Cancel"
,
"Bob"
,
{})
workflow_api
.
cancel_workflow
(
tim_sub
[
'uuid'
],
"Test Cancel"
,
"Bob"
,
{})
workflow
=
StaffWorkflow
.
objects
.
get
(
submission_uuid
=
tim_sub
[
'uuid'
])
workflow
=
StaffWorkflow
.
objects
.
get
(
submission_uuid
=
tim_sub
[
'uuid'
])
self
.
assertIsNotNone
(
workflow
.
cancelled_at
)
self
.
assertTrue
(
workflow
.
is_cancelled
)
def
test_grading_statistics
(
self
):
bob_sub
,
bob
=
self
.
_create_student_and_submission
(
"bob"
,
"bob's answer"
)
course_id
=
bob
[
'course_id'
]
item_id
=
bob
[
'item_id'
]
tim_sub
,
tim
=
self
.
_create_student_and_submission
(
"Tim"
,
"Tim's answer"
)
sue_sub
,
sue
=
self
.
_create_student_and_submission
(
"Sue"
,
"Sue's answer"
)
stats
=
staff_api
.
get_staff_grading_statistics
(
course_id
,
item_id
)
self
.
assertEqual
(
stats
,
{
'graded'
:
0
,
'ungraded'
:
3
,
'in-progress'
:
0
})
# Fetch a grade so that there's one 'in-progress'
tim_to_grade
=
staff_api
.
get_submission_to_assess
(
course_id
,
item_id
,
tim
[
'student_id'
])
stats
=
staff_api
.
get_staff_grading_statistics
(
course_id
,
item_id
)
self
.
assertEqual
(
stats
,
{
'graded'
:
0
,
'ungraded'
:
2
,
'in-progress'
:
1
})
bob_to_grade
=
staff_api
.
get_submission_to_assess
(
tim
[
'course_id'
],
tim
[
'item_id'
],
bob
[
'student_id'
])
stats
=
staff_api
.
get_staff_grading_statistics
(
course_id
,
item_id
)
self
.
assertEqual
(
stats
,
{
'graded'
:
0
,
'ungraded'
:
1
,
'in-progress'
:
2
})
# Grade one of the submissions
staff_assessment
=
staff_api
.
create_assessment
(
tim_to_grade
[
"uuid"
],
tim
[
'student_id'
],
OPTIONS_SELECTED_DICT
[
"all"
][
"options"
],
dict
(),
""
,
RUBRIC
,
)
stats
=
staff_api
.
get_staff_grading_statistics
(
course_id
,
item_id
)
self
.
assertEqual
(
stats
,
{
'graded'
:
1
,
'ungraded'
:
1
,
'in-progress'
:
1
})
# When one of the 'locks' times out, verify that it is no longer
# considered ungraded.
workflow
=
StaffWorkflow
.
objects
.
get
(
scorer_id
=
bob
[
'student_id'
])
timestamp
=
(
now
()
-
(
workflow
.
TIME_LIMIT
+
timedelta
(
hours
=
1
)))
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
workflow
.
grading_started_at
=
timestamp
workflow
.
save
()
stats
=
staff_api
.
get_staff_grading_statistics
(
course_id
,
item_id
)
self
.
assertEqual
(
stats
,
{
'graded'
:
1
,
'ungraded'
:
2
,
'in-progress'
:
0
})
workflow_api
.
cancel_workflow
(
bob_to_grade
[
'uuid'
],
"Test Cancel"
,
bob
[
'student_id'
],
{})
stats
=
staff_api
.
get_staff_grading_statistics
(
course_id
,
item_id
)
self
.
assertEqual
(
stats
,
{
'graded'
:
1
,
'ungraded'
:
1
,
'in-progress'
:
0
})
@staticmethod
@staticmethod
def
_create_student_and_submission
(
student
,
answer
,
date
=
None
,
problem_steps
=
None
):
def
_create_student_and_submission
(
student
,
answer
,
date
=
None
,
problem_steps
=
None
):
...
...
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