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
358aa775
Commit
358aa775
authored
May 13, 2015
by
Andy Armstrong
Committed by
Diana Huang
May 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "Teams Configuration" advanced setting
parent
e7a348d6
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
130 additions
and
1 deletions
+130
-1
cms/djangoapps/models/settings/course_metadata.py
+4
-0
cms/envs/bok_choy.py
+3
-0
cms/envs/common.py
+4
-1
cms/envs/test.py
+4
-0
common/lib/xmodule/xmodule/course_module.py
+34
-0
common/lib/xmodule/xmodule/tests/test_course_module.py
+71
-0
common/test/acceptance/pages/studio/settings_advanced.py
+1
-0
lms/envs/bok_choy.py
+3
-0
lms/envs/common.py
+3
-0
lms/envs/test.py
+3
-0
No files found.
cms/djangoapps/models/settings/course_metadata.py
View file @
358aa775
...
...
@@ -74,6 +74,10 @@ class CourseMetadata(object):
not
settings
.
FEATURES
.
get
(
"DASHBOARD_SHARE_SETTINGS"
)
.
get
(
"CUSTOM_COURSE_URLS"
)):
filtered_list
.
append
(
'social_sharing_url'
)
# Do not show teams configuration if feature is disabled.
if
not
settings
.
FEATURES
.
get
(
'ENABLE_TEAMS'
):
filtered_list
.
append
(
'teams_configuration'
)
return
filtered_list
@classmethod
...
...
cms/envs/bok_choy.py
View file @
358aa775
...
...
@@ -68,6 +68,9 @@ FEATURES['ENABLE_PREREQUISITE_COURSES'] = True
# Enable student notes
FEATURES
[
'ENABLE_EDXNOTES'
]
=
True
# Enable teams feature
FEATURES
[
'ENABLE_TEAMS'
]
=
True
########################### Entrance Exams #################################
FEATURES
[
'ENTRANCE_EXAMS'
]
=
True
...
...
cms/envs/common.py
View file @
358aa775
...
...
@@ -155,7 +155,10 @@ FEATURES = {
'DASHBOARD_SHARE_SETTINGS'
:
{
# Note: Ensure 'CUSTOM_COURSE_URLS' has a matching value in lms/envs/common.py
'CUSTOM_COURSE_URLS'
:
False
}
},
# Teams feature
'ENABLE_TEAMS'
:
False
,
}
ENABLE_JASMINE
=
False
...
...
cms/envs/test.py
View file @
358aa775
...
...
@@ -271,5 +271,9 @@ FEATURES['ENABLE_COURSEWARE_INDEX'] = True
FEATURES
[
'ENABLE_LIBRARY_INDEX'
]
=
True
SEARCH_ENGINE
=
"search.tests.mock_search_engine.MockSearchEngine"
# teams feature
FEATURES
[
'ENABLE_TEAMS'
]
=
True
# Dummy secret key for dev/test
SECRET_KEY
=
'85920908f28904ed733fe576320db18cabd7b6cd'
common/lib/xmodule/xmodule/course_module.py
View file @
358aa775
...
...
@@ -846,6 +846,15 @@ class CourseFields(object):
scope
=
Scope
.
settings
,
)
teams_configuration
=
Dict
(
display_name
=
_
(
"Teams Configuration"
),
help
=
_
(
"Enter configuration for the teams feature. Expects two entries: max_team_size and topics, where "
"topics is a list of topics."
),
scope
=
Scope
.
settings
)
class
CourseModule
(
CourseFields
,
SequenceModule
):
# pylint: disable=abstract-method
"""
...
...
@@ -1408,3 +1417,28 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
return
"course_{}"
.
format
(
b32encode
(
unicode
(
self
.
location
.
course_key
))
.
replace
(
'='
,
padding_char
)
)
@property
def
teams_enabled
(
self
):
"""
Returns whether or not teams has been enabled for this course.
Currently, teams are considered enabled when at least one topic has been configured for the course.
"""
if
self
.
teams_configuration
:
return
len
(
self
.
teams_configuration
.
get
(
'topics'
,
[]))
>
0
return
False
@property
def
teams_max_size
(
self
):
"""
Returns the max size for teams if teams has been configured, else None.
"""
return
self
.
teams_configuration
.
get
(
'max_team_size'
,
None
)
@property
def
teams_topics
(
self
):
"""
Returns the topics that have been configured for teams for this course, else None.
"""
return
self
.
teams_configuration
.
get
(
'topics'
,
None
)
common/lib/xmodule/xmodule/tests/test_course_module.py
View file @
358aa775
...
...
@@ -4,6 +4,7 @@ from datetime import datetime, timedelta
from
fs.memoryfs
import
MemoryFS
from
mock
import
Mock
,
patch
import
itertools
from
xblock.runtime
import
KvsFieldData
,
DictKeyValueStore
...
...
@@ -277,3 +278,73 @@ class DiscussionTopicsTestCase(unittest.TestCase):
def
test_default_discussion_topics
(
self
):
d
=
get_dummy_course
(
'2012-12-02T12:00'
)
self
.
assertEqual
({
'General'
:
{
'id'
:
'i4x-test_org-test_course-course-test'
}},
d
.
discussion_topics
)
class
TeamsConfigurationTestCase
(
unittest
.
TestCase
):
"""
Tests for the configuration of teams and the helper methods for accessing them.
"""
def
setUp
(
self
):
super
(
TeamsConfigurationTestCase
,
self
)
.
setUp
()
self
.
course
=
get_dummy_course
(
'2012-12-02T12:00'
)
self
.
course
.
teams_configuration
=
dict
()
self
.
count
=
itertools
.
count
()
def
add_team_configuration
(
self
,
max_team_size
=
3
,
topics
=
None
):
""" Add a team configuration to the course. """
teams_configuration
=
{}
teams_configuration
[
"topics"
]
=
[]
if
topics
is
None
else
topics
if
max_team_size
is
not
None
:
teams_configuration
[
"max_team_size"
]
=
max_team_size
self
.
course
.
teams_configuration
=
teams_configuration
def
make_topic
(
self
):
""" Make a sample topic dictionary. """
next_num
=
self
.
count
.
next
()
topic_id
=
"topic_id_{}"
.
format
(
next_num
)
display_name
=
"Display Name {}"
.
format
(
next_num
)
description
=
"Description {}"
.
format
(
next_num
)
return
{
"display_name"
:
display_name
,
"description"
:
description
,
"id"
:
topic_id
}
def
test_teams_enabled_new_course
(
self
):
# Make sure we can detect when no teams exist.
self
.
assertFalse
(
self
.
course
.
teams_enabled
)
# add topics
self
.
add_team_configuration
(
max_team_size
=
4
,
topics
=
[
self
.
make_topic
()])
self
.
assertTrue
(
self
.
course
.
teams_enabled
)
# remove them again
self
.
add_team_configuration
(
max_team_size
=
4
,
topics
=
[])
self
.
assertFalse
(
self
.
course
.
teams_enabled
)
def
test_teams_enabled_max_size_only
(
self
):
self
.
add_team_configuration
(
max_team_size
=
4
)
self
.
assertFalse
(
self
.
course
.
teams_enabled
)
def
test_teams_enabled_no_max_size
(
self
):
self
.
add_team_configuration
(
max_team_size
=
None
,
topics
=
[
self
.
make_topic
()])
self
.
assertTrue
(
self
.
course
.
teams_enabled
)
def
test_teams_max_size_no_teams_configuration
(
self
):
self
.
assertIsNone
(
self
.
course
.
teams_max_size
)
def
test_teams_max_size_with_teams_configured
(
self
):
size
=
4
self
.
add_team_configuration
(
max_team_size
=
size
,
topics
=
[
self
.
make_topic
(),
self
.
make_topic
()])
self
.
assertTrue
(
self
.
course
.
teams_enabled
)
self
.
assertEqual
(
size
,
self
.
course
.
teams_max_size
)
def
test_teams_topics_no_teams
(
self
):
self
.
assertIsNone
(
self
.
course
.
teams_topics
)
def
test_teams_topics_no_topics
(
self
):
self
.
add_team_configuration
(
max_team_size
=
4
)
self
.
assertEqual
(
self
.
course
.
teams_topics
,
[])
def
test_teams_topics_with_topics
(
self
):
topics
=
[
self
.
make_topic
(),
self
.
make_topic
()]
self
.
add_team_configuration
(
max_team_size
=
4
,
topics
=
topics
)
self
.
assertTrue
(
self
.
course
.
teams_enabled
)
self
.
assertEqual
(
self
.
course
.
teams_topics
,
topics
)
common/test/acceptance/pages/studio/settings_advanced.py
View file @
358aa775
...
...
@@ -198,4 +198,5 @@ class AdvancedSettingsPage(CoursePage):
'text_customization'
,
'annotation_storage_url'
,
'social_sharing_url'
,
'teams_configuration'
,
]
lms/envs/bok_choy.py
View file @
358aa775
...
...
@@ -96,6 +96,9 @@ FEATURES['ENABLE_PREREQUISITE_COURSES'] = True
# Enable student notes
FEATURES
[
'ENABLE_EDXNOTES'
]
=
True
# Enable teams feature
FEATURES
[
'ENABLE_TEAMS'
]
=
True
# Unfortunately, we need to use debug mode to serve staticfiles
DEBUG
=
True
...
...
lms/envs/common.py
View file @
358aa775
...
...
@@ -386,6 +386,9 @@ FEATURES = {
# Software secure fake page feature flag
'ENABLE_SOFTWARE_SECURE_FAKE'
:
False
,
# Teams feature
'ENABLE_TEAMS'
:
False
,
}
# Ignore static asset files on import which match this pattern
...
...
lms/envs/test.py
View file @
358aa775
...
...
@@ -449,6 +449,9 @@ MONGODB_LOG = {
# Enable EdxNotes for tests.
FEATURES
[
'ENABLE_EDXNOTES'
]
=
True
# Enable teams feature for tests.
FEATURES
[
'ENABLE_TEAMS'
]
=
True
# Add milestones to Installed apps for testing
INSTALLED_APPS
+=
(
'milestones'
,
)
...
...
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