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
7c04113a
Commit
7c04113a
authored
Mar 14, 2017
by
Eric Fischer
Committed by
GitHub
Mar 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #973 from CredoReference/oraaggregatedata.collect_ora2_responses
New OraAggregateData.collect_ora2_responses method
parents
64239426
4f5bf806
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
3 deletions
+126
-3
AUTHORS
+1
-0
openassessment/data.py
+39
-0
openassessment/tests/test_data.py
+86
-3
No files found.
AUTHORS
View file @
7c04113a
...
@@ -25,3 +25,4 @@ Eric Fischer <efischer@edx.org>
...
@@ -25,3 +25,4 @@ Eric Fischer <efischer@edx.org>
Andy Armstrong <andya@edx.org>
Andy Armstrong <andya@edx.org>
Christina Roberts <christina@edx.org>
Christina Roberts <christina@edx.org>
Mushtaq Ali <mushtaak@gmail.com>
Mushtaq Ali <mushtaak@gmail.com>
Dmitry Viskov <dmitry.viskov@webenterprise.ru>
openassessment/data.py
View file @
7c04113a
...
@@ -4,6 +4,7 @@ Aggregate data for openassessment.
...
@@ -4,6 +4,7 @@ Aggregate data for openassessment.
import
csv
import
csv
import
json
import
json
from
collections
import
defaultdict
from
django.conf
import
settings
from
django.conf
import
settings
from
submissions
import
api
as
sub_api
from
submissions
import
api
as
sub_api
from
openassessment.workflow.models
import
AssessmentWorkflow
from
openassessment.workflow.models
import
AssessmentWorkflow
...
@@ -495,3 +496,41 @@ class OraAggregateData(object):
...
@@ -495,3 +496,41 @@ class OraAggregateData(object):
'Feedback on Peer Assessments'
'Feedback on Peer Assessments'
]
]
return
header
,
rows
return
header
,
rows
@classmethod
def
collect_ora2_responses
(
cls
,
course_id
,
desired_statuses
=
None
):
"""
Get information about all ora2 blocks in the course with response count for each step
Args:
course_id (string) - the course id of the course whose data we would like to return
desired_statuses (list) - statuses to return in the result dict for each ora item
Returns:
A dict in the format:
{
'block-v1:test-org+cs101+2017_TEST+type@openassessment+block@fb668396b505470e914bad8b3178e9e7:
{'training': 0, 'self': 0, 'done': 2, 'peer': 1, 'staff': 0, 'total': 3},
'block-v1:test-org+cs101+2017_TEST+type@openassessment+block@90b4edff50bc47d9ba037a3180c44e97:
{'training': 0, 'self': 2, 'done': 0, 'peer': 0, 'staff': 2, 'total': 4},
...
}
"""
if
desired_statuses
:
statuses
=
[
st
for
st
in
AssessmentWorkflow
()
.
STATUS_VALUES
if
st
in
desired_statuses
]
else
:
statuses
=
AssessmentWorkflow
()
.
STATUS_VALUES
items
=
AssessmentWorkflow
.
objects
.
filter
(
course_id
=
course_id
,
status__in
=
statuses
)
.
values
(
'item_id'
,
'status'
)
result
=
defaultdict
(
lambda
:
{
status
:
0
for
status
in
statuses
})
for
item
in
items
:
item_id
=
item
[
'item_id'
]
status
=
item
[
'status'
]
result
[
item_id
][
'total'
]
=
result
[
item_id
]
.
get
(
'total'
,
0
)
+
1
if
status
in
statuses
:
result
[
item_id
][
status
]
+=
1
return
result
openassessment/tests/test_data.py
View file @
7c04113a
...
@@ -23,7 +23,7 @@ STUDENT_ID = "Student"
...
@@ -23,7 +23,7 @@ STUDENT_ID = "Student"
SCORER_ID
=
"Scorer"
SCORER_ID
=
"Scorer"
ITEM_ID
=
"item
_one
"
ITEM_ID
=
"item"
STUDENT_ITEM
=
dict
(
STUDENT_ITEM
=
dict
(
student_id
=
STUDENT_ID
,
student_id
=
STUDENT_ID
,
...
@@ -376,14 +376,14 @@ class TestOraAggregateDataIntegration(TransactionCacheResetTest):
...
@@ -376,14 +376,14 @@ class TestOraAggregateDataIntegration(TransactionCacheResetTest):
peer_api
.
get_score
(
self
.
submission
[
'uuid'
],
{
'must_be_graded_by'
:
1
,
'must_grade'
:
0
})
peer_api
.
get_score
(
self
.
submission
[
'uuid'
],
{
'must_be_graded_by'
:
1
,
'must_grade'
:
0
})
self
.
_create_assessment_feedback
(
self
.
submission
[
'uuid'
])
self
.
_create_assessment_feedback
(
self
.
submission
[
'uuid'
])
def
_create_submission
(
self
,
student_item_dict
):
def
_create_submission
(
self
,
student_item_dict
,
steps
=
None
):
"""
"""
Creates a submission and initializes a peer grading workflow.
Creates a submission and initializes a peer grading workflow.
"""
"""
submission
=
sub_api
.
create_submission
(
student_item_dict
,
ANSWER
)
submission
=
sub_api
.
create_submission
(
student_item_dict
,
ANSWER
)
submission_uuid
=
submission
[
'uuid'
]
submission_uuid
=
submission
[
'uuid'
]
peer_api
.
on_start
(
submission_uuid
)
peer_api
.
on_start
(
submission_uuid
)
workflow_api
.
create_workflow
(
submission_uuid
,
STEPS
)
workflow_api
.
create_workflow
(
submission_uuid
,
steps
if
steps
else
STEPS
)
return
submission
return
submission
def
_create_assessment
(
self
,
submission_uuid
):
def
_create_assessment
(
self
,
submission_uuid
):
...
@@ -408,6 +408,18 @@ class TestOraAggregateDataIntegration(TransactionCacheResetTest):
...
@@ -408,6 +408,18 @@ class TestOraAggregateDataIntegration(TransactionCacheResetTest):
feedback_dict
[
'submission_uuid'
]
=
submission_uuid
feedback_dict
[
'submission_uuid'
]
=
submission_uuid
peer_api
.
set_assessment_feedback
(
feedback_dict
)
peer_api
.
set_assessment_feedback
(
feedback_dict
)
def
_other_student
(
self
,
n
):
"""
n is an integer to postfix, for example _other_student(3) would return "Student_3"
"""
return
STUDENT_ID
+
'_'
+
str
(
n
)
def
_other_item
(
self
,
n
):
"""
n is an integer to postfix, for example _other_item(4) would return "item_4"
"""
return
ITEM_ID
+
'_'
+
str
(
n
)
def
test_collect_ora2_data
(
self
):
def
test_collect_ora2_data
(
self
):
headers
,
data
=
OraAggregateData
.
collect_ora2_data
(
COURSE_ID
)
headers
,
data
=
OraAggregateData
.
collect_ora2_data
(
COURSE_ID
)
...
@@ -474,3 +486,74 @@ class TestOraAggregateDataIntegration(TransactionCacheResetTest):
...
@@ -474,3 +486,74 @@ class TestOraAggregateDataIntegration(TransactionCacheResetTest):
FEEDBACK_OPTIONS
[
'options'
][
0
]
+
'
\n
'
+
FEEDBACK_OPTIONS
[
'options'
][
1
]
+
'
\n
'
,
FEEDBACK_OPTIONS
[
'options'
][
0
]
+
'
\n
'
+
FEEDBACK_OPTIONS
[
'options'
][
1
]
+
'
\n
'
,
FEEDBACK_TEXT
,
FEEDBACK_TEXT
,
])
])
def
test_collect_ora2_responses
(
self
):
item_id2
=
self
.
_other_item
(
2
)
item_id3
=
self
.
_other_item
(
3
)
student_id2
=
self
.
_other_student
(
2
)
student_id3
=
self
.
_other_student
(
3
)
self
.
_create_submission
(
dict
(
student_id
=
STUDENT_ID
,
course_id
=
COURSE_ID
,
item_id
=
item_id2
,
item_type
=
"openassessment"
),
[
'self'
])
self
.
_create_submission
(
dict
(
student_id
=
student_id2
,
course_id
=
COURSE_ID
,
item_id
=
item_id2
,
item_type
=
"openassessment"
),
STEPS
)
self
.
_create_submission
(
dict
(
student_id
=
STUDENT_ID
,
course_id
=
COURSE_ID
,
item_id
=
item_id3
,
item_type
=
"openassessment"
),
[
'self'
])
self
.
_create_submission
(
dict
(
student_id
=
student_id2
,
course_id
=
COURSE_ID
,
item_id
=
item_id3
,
item_type
=
"openassessment"
),
[
'self'
])
self
.
_create_submission
(
dict
(
student_id
=
student_id3
,
course_id
=
COURSE_ID
,
item_id
=
item_id3
,
item_type
=
"openassessment"
),
STEPS
)
data
=
OraAggregateData
.
collect_ora2_responses
(
COURSE_ID
)
self
.
assertIn
(
ITEM_ID
,
data
)
self
.
assertIn
(
item_id2
,
data
)
self
.
assertIn
(
item_id3
,
data
)
for
item
in
[
ITEM_ID
,
item_id2
,
item_id3
]:
self
.
assertEqual
({
'total'
,
'training'
,
'peer'
,
'self'
,
'staff'
,
'waiting'
,
'done'
,
'ai'
,
'cancelled'
},
set
(
data
[
item
]
.
keys
()))
self
.
assertEqual
(
data
[
ITEM_ID
],
{
'total'
:
2
,
'training'
:
0
,
'peer'
:
2
,
'self'
:
0
,
'staff'
:
0
,
'waiting'
:
0
,
'done'
:
0
,
'ai'
:
0
,
'cancelled'
:
0
})
self
.
assertEqual
(
data
[
item_id2
],
{
'total'
:
2
,
'training'
:
0
,
'peer'
:
1
,
'self'
:
1
,
'staff'
:
0
,
'waiting'
:
0
,
'done'
:
0
,
'ai'
:
0
,
'cancelled'
:
0
})
self
.
assertEqual
(
data
[
item_id3
],
{
'total'
:
3
,
'training'
:
0
,
'peer'
:
1
,
'self'
:
2
,
'staff'
:
0
,
'waiting'
:
0
,
'done'
:
0
,
'ai'
:
0
,
'cancelled'
:
0
})
data
=
OraAggregateData
.
collect_ora2_responses
(
COURSE_ID
,
[
'staff'
,
'peer'
])
self
.
assertIn
(
ITEM_ID
,
data
)
self
.
assertIn
(
item_id2
,
data
)
self
.
assertIn
(
item_id3
,
data
)
for
item
in
[
ITEM_ID
,
item_id2
,
item_id3
]:
self
.
assertEqual
({
'total'
,
'peer'
,
'staff'
},
set
(
data
[
item
]
.
keys
()))
self
.
assertEqual
(
data
[
ITEM_ID
],
{
'total'
:
2
,
'peer'
:
2
,
'staff'
:
0
})
self
.
assertEqual
(
data
[
item_id2
],
{
'total'
:
1
,
'peer'
:
1
,
'staff'
:
0
})
self
.
assertEqual
(
data
[
item_id3
],
{
'total'
:
1
,
'peer'
:
1
,
'staff'
:
0
})
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