Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
6317347d
Commit
6317347d
authored
Nov 25, 2014
by
Muhammad Ammar
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5983 from edx/ammar/tnl-827
Remove ability to add new ORA 1 problems to courses
parents
a883a9cd
a493348c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
1 deletions
+52
-1
cms/djangoapps/contentstore/tests/test_contentstore.py
+2
-0
cms/djangoapps/contentstore/views/component.py
+9
-1
cms/djangoapps/contentstore/views/tests/test_item.py
+37
-0
cms/envs/common.py
+4
-0
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
6317347d
...
...
@@ -4,6 +4,7 @@
import
copy
import
mock
from
mock
import
patch
import
shutil
import
lxml
...
...
@@ -536,6 +537,7 @@ class MiscCourseTests(ContentStoreTestCase):
for
expected
in
expected_types
:
self
.
assertIn
(
expected
,
resp
.
content
)
@patch
(
'django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES'
,
[])
def
test_advanced_components_in_edit_unit
(
self
):
# This could be made better, but for now let's just assert that we see the advanced modules mentioned in the page
# response HTML
...
...
cms/djangoapps/contentstore/views/component.py
View file @
6317347d
...
...
@@ -56,6 +56,13 @@ ADVANCED_COMPONENT_POLICY_KEY = 'advanced_modules'
ADVANCED_PROBLEM_TYPES
=
settings
.
ADVANCED_PROBLEM_TYPES
def
_advanced_component_types
():
"""
Return advanced component types which can be created.
"""
return
[
c_type
for
c_type
in
ADVANCED_COMPONENT_TYPES
if
c_type
not
in
settings
.
DEPRECATED_ADVANCED_COMPONENT_TYPES
]
@require_GET
@login_required
def
subsection_handler
(
request
,
usage_key_string
):
...
...
@@ -292,10 +299,11 @@ def get_component_templates(course):
# enabled for the course.
course_advanced_keys
=
course
.
advanced_modules
advanced_component_templates
=
{
"type"
:
"advanced"
,
"templates"
:
[],
"display_name"
:
_
(
"Advanced"
)}
advanced_component_types
=
_advanced_component_types
()
# Set component types according to course policy file
if
isinstance
(
course_advanced_keys
,
list
):
for
category
in
course_advanced_keys
:
if
category
in
ADVANCED_COMPONENT_TYPES
and
not
category
in
categories
:
if
category
in
advanced_component_types
and
not
category
in
categories
:
# boilerplates not supported for advanced components
try
:
component_display_name
=
xblock_type_display_name
(
category
,
default_display_name
=
category
)
...
...
cms/djangoapps/contentstore/views/tests/test_item.py
View file @
6317347d
...
...
@@ -1203,6 +1203,43 @@ class TestComponentTemplates(CourseTestCase):
self
.
assertEqual
(
ora_template
.
get
(
'category'
),
'openassessment'
)
self
.
assertIsNone
(
ora_template
.
get
(
'boilerplate_name'
,
None
))
@patch
(
'django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES'
,
[
"combinedopenended"
,
"peergrading"
])
def
test_ora1_no_advance_component_button
(
self
):
"""
Test that there will be no `Advanced` button on unit page if `combinedopenended` and `peergrading` are
deprecated provided that there are only 'combinedopenended', 'peergrading' modules in `Advanced Module List`
"""
self
.
course
.
advanced_modules
.
extend
([
'combinedopenended'
,
'peergrading'
])
templates
=
get_component_templates
(
self
.
course
)
button_names
=
[
template
[
'display_name'
]
for
template
in
templates
]
self
.
assertNotIn
(
'Advanced'
,
button_names
)
@patch
(
'django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES'
,
[
"combinedopenended"
,
"peergrading"
])
def
test_cannot_create_ora1_problems
(
self
):
"""
Test that we can't create ORA1 problems if `combinedopenended` and `peergrading` are deprecated
"""
self
.
course
.
advanced_modules
.
extend
([
'annotatable'
,
'combinedopenended'
,
'peergrading'
])
templates
=
get_component_templates
(
self
.
course
)
button_names
=
[
template
[
'display_name'
]
for
template
in
templates
]
self
.
assertIn
(
'Advanced'
,
button_names
)
self
.
assertEqual
(
len
(
templates
[
0
][
'templates'
]),
1
)
template_display_names
=
[
template
[
'display_name'
]
for
template
in
templates
[
0
][
'templates'
]]
self
.
assertEqual
(
template_display_names
,
[
'Annotation'
])
@patch
(
'django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES'
,
[])
def
test_create_ora1_problems
(
self
):
"""
Test that we can create ORA1 problems if `combinedopenended` and `peergrading` are not deprecated
"""
self
.
course
.
advanced_modules
.
extend
([
'annotatable'
,
'combinedopenended'
,
'peergrading'
])
templates
=
get_component_templates
(
self
.
course
)
button_names
=
[
template
[
'display_name'
]
for
template
in
templates
]
self
.
assertIn
(
'Advanced'
,
button_names
)
self
.
assertEqual
(
len
(
templates
[
0
][
'templates'
]),
3
)
template_display_names
=
[
template
[
'display_name'
]
for
template
in
templates
[
0
][
'templates'
]]
self
.
assertEqual
(
template_display_names
,
[
'Annotation'
,
'Open Response Assessment'
,
'Peer Grading Interface'
])
class
TestXBlockInfo
(
ItemTest
):
"""
...
...
cms/envs/common.py
View file @
6317347d
...
...
@@ -743,6 +743,10 @@ ADVANCED_COMPONENT_TYPES = [
'notes'
,
]
# Adding components in this list will disable the creation of new problem for those
# compoenents in studio. Existing problems will work fine and one can edit them in studio
DEPRECATED_ADVANCED_COMPONENT_TYPES
=
[]
# Specify xblocks that should be treated as advanced problems. Each entry is a tuple
# specifying the xblock name and an optional YAML template to be used.
ADVANCED_PROBLEM_TYPES
=
[
...
...
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