Merge pull request #14830 from edx/christina/change-default-cohorting
Change default value for "always_cohort_inline_discussions" to False
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('course_groups', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='coursecohortssettings',
|
||||
name='always_cohort_inline_discussions',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
@@ -176,8 +176,11 @@ class CourseCohortsSettings(models.Model):
|
||||
|
||||
_cohorted_discussions = models.TextField(db_column='cohorted_discussions', null=True, blank=True) # JSON list
|
||||
|
||||
# Note that although a default value is specified here for always_cohort_inline_discussions (False),
|
||||
# in reality the default value at the time that cohorting is enabled for a course comes from
|
||||
# course_module.always_cohort_inline_discussions (via `migrate_cohort_settings`).
|
||||
# pylint: disable=invalid-name
|
||||
always_cohort_inline_discussions = models.BooleanField(default=True)
|
||||
always_cohort_inline_discussions = models.BooleanField(default=False)
|
||||
|
||||
@property
|
||||
def cohorted_discussions(self):
|
||||
|
||||
@@ -58,7 +58,7 @@ class CourseCohortSettingsFactory(DjangoModelFactory):
|
||||
course_id = SlashSeparatedCourseKey("dummy", "dummy", "dummy")
|
||||
cohorted_discussions = json.dumps([])
|
||||
# pylint: disable=invalid-name
|
||||
always_cohort_inline_discussions = True
|
||||
always_cohort_inline_discussions = False
|
||||
|
||||
|
||||
def topic_name_to_id(course, name):
|
||||
@@ -141,7 +141,7 @@ def config_course_cohorts(
|
||||
manual_cohorts=[],
|
||||
discussion_topics=[],
|
||||
cohorted_discussions=[],
|
||||
always_cohort_inline_discussions=True
|
||||
always_cohort_inline_discussions=False
|
||||
):
|
||||
"""
|
||||
Set discussions and configure cohorts for a course.
|
||||
|
||||
@@ -681,7 +681,7 @@ class TestCohorts(ModuleStoreTestCase):
|
||||
|
||||
self.assertFalse(course_cohort_settings.is_cohorted)
|
||||
self.assertEqual(course_cohort_settings.cohorted_discussions, [])
|
||||
self.assertTrue(course_cohort_settings.always_cohort_inline_discussions)
|
||||
self.assertFalse(course_cohort_settings.always_cohort_inline_discussions)
|
||||
|
||||
def test_update_course_cohort_settings(self):
|
||||
"""
|
||||
@@ -694,14 +694,14 @@ class TestCohorts(ModuleStoreTestCase):
|
||||
course.id,
|
||||
is_cohorted=False,
|
||||
cohorted_discussions=['topic a id', 'topic b id'],
|
||||
always_cohort_inline_discussions=False
|
||||
always_cohort_inline_discussions=True
|
||||
)
|
||||
|
||||
course_cohort_settings = cohorts.get_course_cohort_settings(course.id)
|
||||
|
||||
self.assertFalse(course_cohort_settings.is_cohorted)
|
||||
self.assertEqual(course_cohort_settings.cohorted_discussions, ['topic a id', 'topic b id'])
|
||||
self.assertFalse(course_cohort_settings.always_cohort_inline_discussions)
|
||||
self.assertTrue(course_cohort_settings.always_cohort_inline_discussions)
|
||||
|
||||
def test_update_course_cohort_settings_with_invalid_data_type(self):
|
||||
"""
|
||||
|
||||
@@ -189,7 +189,7 @@ class CourseCohortSettingsHandlerTestCase(CohortViewsTestCase):
|
||||
"""
|
||||
return {
|
||||
'is_cohorted': True,
|
||||
'always_cohort_inline_discussions': True,
|
||||
'always_cohort_inline_discussions': False,
|
||||
'cohorted_inline_discussions': [],
|
||||
'cohorted_course_wide_discussions': [],
|
||||
'id': 1
|
||||
@@ -247,7 +247,7 @@ class CourseCohortSettingsHandlerTestCase(CohortViewsTestCase):
|
||||
|
||||
self.assertEqual(response, expected_response)
|
||||
|
||||
expected_response['always_cohort_inline_discussions'] = False
|
||||
expected_response['always_cohort_inline_discussions'] = True
|
||||
response = self.patch_handler(self.course, data=expected_response, handler=course_cohort_settings_handler)
|
||||
|
||||
self.assertEqual(response, expected_response)
|
||||
|
||||
Reference in New Issue
Block a user