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
16a41c64
Commit
16a41c64
authored
Mar 10, 2016
by
Eric Fischer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #891 from edx/efischer/clear_state_user
Use passed-in requesting_user_id
parents
90e7930a
daaf75ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
openassessment/xblock/staff_area_mixin.py
+9
-5
openassessment/xblock/test/test_staff_area.py
+2
-2
No files found.
openassessment/xblock/staff_area_mixin.py
View file @
16a41c64
...
@@ -492,7 +492,7 @@ class StaffAreaMixin(object):
...
@@ -492,7 +492,7 @@ class StaffAreaMixin(object):
'msg'
:
self
.
_
(
u"An error occurred while rescheduling tasks: {}"
.
format
(
ex
))
'msg'
:
self
.
_
(
u"An error occurred while rescheduling tasks: {}"
.
format
(
ex
))
}
}
def
clear_student_state
(
self
,
user_id
,
course_id
,
item_id
):
def
clear_student_state
(
self
,
user_id
,
course_id
,
item_id
,
requesting_user_id
):
"""
"""
This xblock method is called (from our LMS runtime, which defines this method signature) to clear student state
This xblock method is called (from our LMS runtime, which defines this method signature) to clear student state
for a given problem. It will cancel the workflow using traditional methods to remove it from the grading pools,
for a given problem. It will cancel the workflow using traditional methods to remove it from the grading pools,
...
@@ -509,7 +509,7 @@ class StaffAreaMixin(object):
...
@@ -509,7 +509,7 @@ class StaffAreaMixin(object):
submissions
=
submission_api
.
get_submissions
(
student_item
)
submissions
=
submission_api
.
get_submissions
(
student_item
)
for
sub
in
submissions
:
for
sub
in
submissions
:
# Remove the submission from grading pools
# Remove the submission from grading pools
self
.
_cancel_workflow
(
sub
[
'uuid'
],
"Student state cleared"
)
self
.
_cancel_workflow
(
sub
[
'uuid'
],
"Student state cleared"
,
requesting_user_id
=
requesting_user_id
)
# Tell the submissions API to orphan the submission to prevent it from being accessed
# Tell the submissions API to orphan the submission to prevent it from being accessed
submission_api
.
reset_score
(
submission_api
.
reset_score
(
...
@@ -547,17 +547,21 @@ class StaffAreaMixin(object):
...
@@ -547,17 +547,21 @@ class StaffAreaMixin(object):
return
self
.
_cancel_workflow
(
submission_uuid
,
comments
)
return
self
.
_cancel_workflow
(
submission_uuid
,
comments
)
def
_cancel_workflow
(
self
,
submission_uuid
,
comments
):
def
_cancel_workflow
(
self
,
submission_uuid
,
comments
,
requesting_user_id
=
None
):
"""
"""
Internal helper method to cancel a workflow using the workflow API.
Internal helper method to cancel a workflow using the workflow API.
If requesting_user is not provided, we will use the user to which this xblock is currently bound.
"""
"""
try
:
try
:
assessment_requirements
=
self
.
workflow_requirements
()
assessment_requirements
=
self
.
workflow_requirements
()
student_item_dict
=
self
.
get_student_item_dict
()
if
requesting_user_id
is
None
:
"The student_id is actually the bound user, which is the staff user in this context."
requesting_user_id
=
self
.
get_student_item_dict
()[
"student_id"
]
# Cancel the related workflow.
# Cancel the related workflow.
workflow_api
.
cancel_workflow
(
workflow_api
.
cancel_workflow
(
submission_uuid
=
submission_uuid
,
comments
=
comments
,
submission_uuid
=
submission_uuid
,
comments
=
comments
,
cancelled_by_id
=
student_item_dict
[
'student_id'
]
,
cancelled_by_id
=
requesting_user_id
,
assessment_requirements
=
assessment_requirements
assessment_requirements
=
assessment_requirements
)
)
return
{
return
{
...
...
openassessment/xblock/test/test_staff_area.py
View file @
16a41c64
...
@@ -769,8 +769,8 @@ class TestCourseStaff(XBlockHandlerTestCase):
...
@@ -769,8 +769,8 @@ class TestCourseStaff(XBlockHandlerTestCase):
resp
=
xblock
.
render_student_info
(
request
)
resp
=
xblock
.
render_student_info
(
request
)
self
.
assertIn
(
"final grade"
,
resp
.
body
.
lower
())
self
.
assertIn
(
"final grade"
,
resp
.
body
.
lower
())
#
Clear the
submission
#
Staff user Bob can clear his own
submission
xblock
.
clear_student_state
(
'Bob'
,
'test_course'
,
xblock
.
scope_ids
.
usage_id
)
xblock
.
clear_student_state
(
'Bob'
,
'test_course'
,
xblock
.
scope_ids
.
usage_id
,
bob_item
[
'student_id'
]
)
# Verify that the submission was cleared
# Verify that the submission was cleared
resp
=
xblock
.
render_student_info
(
request
)
resp
=
xblock
.
render_student_info
(
request
)
...
...
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