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
c28cd6d2
Commit
c28cd6d2
authored
Mar 29, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide course staff debug info in studio preview
parent
aee89c7f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
6 deletions
+31
-6
apps/openassessment/xblock/openassessmentblock.py
+15
-1
apps/openassessment/xblock/submission_mixin.py
+1
-3
apps/openassessment/xblock/test/test_openassessment.py
+15
-2
No files found.
apps/openassessment/xblock/openassessmentblock.py
View file @
c28cd6d2
...
...
@@ -293,7 +293,7 @@ class OpenAssessmentBlock(
"is_course_staff"
:
False
,
}
if
self
.
is_course_staff
:
if
self
.
is_course_staff
and
not
self
.
in_studio_preview
:
status_counts
,
num_submissions
=
self
.
get_workflow_status_counts
()
context_dict
[
'is_course_staff'
]
=
True
context_dict
[
'status_counts'
]
=
status_counts
...
...
@@ -321,6 +321,20 @@ class OpenAssessmentBlock(
else
:
return
False
@property
def
in_studio_preview
(
self
):
"""
Check whether we are in Studio preview mode.
Returns:
bool
"""
# When we're running in Studio Preview mode, the XBlock won't provide us with a user ID.
# (Note that `self.xmodule_runtime` will still provide an anonymous
# student ID, so we can't rely on that)
return
self
.
scope_ids
.
user_id
is
None
def
_create_ui_models
(
self
):
"""Combine UI attributes and XBlock configuration into a UI model.
...
...
apps/openassessment/xblock/submission_mixin.py
View file @
c28cd6d2
...
...
@@ -59,9 +59,7 @@ class SubmissionMixin(object):
# Short-circuit if no user is defined (as in Studio Preview mode)
# Since students can't submit, they will never be able to progress in the workflow
# Studio Preview provides an anonymous student ID, so we need to check the scope ids directly
# to check that we are in preview mode.
if
self
.
scope_ids
.
user_id
is
None
:
if
self
.
in_studio_preview
:
return
False
,
'ENOPREVIEW'
,
self
.
submit_errors
[
'ENOPREVIEW'
]
workflow
=
self
.
get_workflow_info
()
...
...
apps/openassessment/xblock/test/test_openassessment.py
View file @
c28cd6d2
...
...
@@ -145,7 +145,7 @@ class TestOpenAssessment(XBlockHandlerTestCase):
self
.
assertEqual
(
student_item
[
'course_id'
],
'test_course'
)
self
.
assertEqual
(
student_item
[
'student_id'
],
'test_student'
)
@scenario
(
'data/basic_scenario.xml'
)
@scenario
(
'data/basic_scenario.xml'
,
user_id
=
'Bob'
)
def
test_is_course_staff
(
self
,
xblock
):
# By default, we shouldn't be course staff
self
.
assertFalse
(
xblock
.
is_course_staff
)
...
...
@@ -160,7 +160,7 @@ class TestOpenAssessment(XBlockHandlerTestCase):
xblock
.
xmodule_runtime
.
user_is_staff
=
True
self
.
assertTrue
(
xblock
.
is_course_staff
)
@scenario
(
'data/basic_scenario.xml'
)
@scenario
(
'data/basic_scenario.xml'
,
user_id
=
'Bob'
)
def
test_course_staff_debug_info
(
self
,
xblock
):
# If we're not course staff, we shouldn't see the debug info
xblock
.
xmodule_runtime
=
Mock
(
...
...
@@ -176,6 +176,19 @@ class TestOpenAssessment(XBlockHandlerTestCase):
xblock_fragment
=
self
.
runtime
.
render
(
xblock
,
"student_view"
)
self
.
assertIn
(
"course staff information"
,
xblock_fragment
.
body_html
()
.
lower
())
@scenario
(
'data/basic_scenario.xml'
)
def
test_hide_course_staff_debug_info_in_studio_preview
(
self
,
xblock
):
# If we are in Studio preview mode, don't show the staff debug info
# In this case, the runtime will tell us that we're staff,
# but no user ID will be set.
xblock
.
xmodule_runtime
=
Mock
(
course_id
=
'test_course'
,
anonymous_student_id
=
'test_student'
,
user_is_staff
=
True
)
xblock_fragment
=
self
.
runtime
.
render
(
xblock
,
"student_view"
)
self
.
assertNotIn
(
"course staff information"
,
xblock_fragment
.
body_html
()
.
lower
())
class
TestDates
(
XBlockHandlerTestCase
):
...
...
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