From 52c4395a034c0615f19e4a2a15e9008017c94561 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Wed, 2 Oct 2013 16:14:26 -0400 Subject: [PATCH 1/2] Fix parentheses so that we only pull the course modes we want. --- common/djangoapps/course_modes/models.py | 4 ++-- common/djangoapps/course_modes/tests/test_models.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/common/djangoapps/course_modes/models.py b/common/djangoapps/course_modes/models.py index fa1a687e47..ce15059643 100644 --- a/common/djangoapps/course_modes/models.py +++ b/common/djangoapps/course_modes/models.py @@ -55,8 +55,8 @@ class CourseMode(models.Model): """ now = datetime.now(pytz.UTC) found_course_modes = cls.objects.filter(Q(course_id=course_id) & - Q(expiration_date__isnull=True) | - Q(expiration_date__gte=now)) + (Q(expiration_date__isnull=True) | + Q(expiration_date__gte=now))) modes = ([Mode(mode.mode_slug, mode.mode_display_name, mode.min_price, mode.suggested_prices, mode.currency) for mode in found_course_modes]) if not modes: diff --git a/common/djangoapps/course_modes/tests/test_models.py b/common/djangoapps/course_modes/tests/test_models.py index deeed6ea9b..651c7c51a5 100644 --- a/common/djangoapps/course_modes/tests/test_models.py +++ b/common/djangoapps/course_modes/tests/test_models.py @@ -102,3 +102,12 @@ class CourseModeModelTest(TestCase): self.create_mode(mode1.slug, mode1.name, mode1.min_price, mode1.suggested_prices) modes = CourseMode.modes_for_course(self.course_id) self.assertEqual([mode1], modes) + + expired_mode.expiration_date = datetime.now(pytz.UTC) + timedelta(days=1) + expired_mode.save() + expired_mode_value = Mode(u'verified', u'Verified Certificate', 0, '', 'usd') + modes = CourseMode.modes_for_course(self.course_id) + self.assertEqual([expired_mode_value, mode1], modes) + + modes = CourseMode.modes_for_course('second_test_course') + self.assertEqual([CourseMode.DEFAULT_MODE], modes) From a00470428a0a51871fb5f593985f81fcb4e8e480 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Thu, 3 Oct 2013 08:30:32 -0400 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 78237150cd..ce660f82ac 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,9 @@ These are notable changes in edx-platform. This is a rolling list of changes, in roughly chronological order, most recent first. Add your entries at or near the top. Include a label indicating the component affected. + +LMS: Fix issue with CourseMode expiration dates + LMS: Add PaidCourseRegistration mode, where payment is required before course registration. LMS: Add split testing functionality for internal use.