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
9d4bf890
Commit
9d4bf890
authored
Aug 28, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude courses from the auto-registration A/B test
parent
3af9943d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
10 deletions
+62
-10
common/djangoapps/student/tests/test_enrollment.py
+26
-3
common/djangoapps/student/views.py
+15
-7
lms/envs/aws.py
+3
-0
lms/envs/common.py
+18
-0
No files found.
common/djangoapps/student/tests/test_enrollment.py
View file @
9d4bf890
...
...
@@ -78,7 +78,6 @@ class EnrollmentTest(ModuleStoreTestCase):
course_id
=
self
.
course
.
id
,
mode_slug
=
mode_slug
,
mode_display_name
=
mode_slug
,
expiration_datetime
=
datetime
.
now
(
pytz
.
UTC
)
+
timedelta
(
days
=
1
)
)
# Reverse the expected next URL, if one is provided
...
...
@@ -126,8 +125,7 @@ class EnrollmentTest(ModuleStoreTestCase):
CourseModeFactory
.
create
(
course_id
=
self
.
course
.
id
,
mode_slug
=
mode_slug
,
mode_display_name
=
mode_slug
,
expiration_datetime
=
datetime
.
now
(
pytz
.
UTC
)
+
timedelta
(
days
=
1
)
mode_display_name
=
mode_slug
)
# Log out, so we're no longer authenticated
...
...
@@ -155,6 +153,31 @@ class EnrollmentTest(ModuleStoreTestCase):
self
.
assertIn
(
'auto_register'
,
self
.
client
.
session
)
self
.
assertTrue
(
self
.
client
.
session
[
'auto_register'
])
# TODO (ECOM-16): Remove once the auto-registration A/B test completes
def
test_enroll_auto_registration_excluded_course
(
self
):
# Create the course modes
for
mode_slug
in
[
'honor'
,
'audit'
,
'verified'
]:
CourseModeFactory
.
create
(
course_id
=
self
.
course
.
id
,
mode_slug
=
mode_slug
,
mode_display_name
=
mode_slug
,
)
# Visit the experimental condition URL (when the course is NOT excluded)
# This should place us into the experimental condition flow
self
.
_change_enrollment
(
'enroll'
,
auto_reg
=
True
)
# Unenroll from the course (we were registered because auto enroll was enabled)
self
.
_change_enrollment
(
'unenroll'
)
# Register for the course again, with the course excluded
# At this point, we should NOT be in the experimental condition flow
excluded_course_ids
=
[
self
.
course
.
id
.
to_deprecated_string
()]
with
self
.
settings
(
AUTO_REGISTRATION_AB_TEST_EXCLUDE_COURSES
=
excluded_course_ids
):
self
.
_change_enrollment
(
'enroll'
)
self
.
assertFalse
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
self
.
course
.
id
))
self
.
assertNotIn
(
'auto_register'
,
self
.
client
.
session
)
def
test_unenroll
(
self
):
# Enroll the student in the course
CourseEnrollment
.
enroll
(
self
.
user
,
self
.
course
.
id
,
mode
=
"honor"
)
...
...
common/djangoapps/student/views.py
View file @
9d4bf890
...
...
@@ -619,6 +619,14 @@ def change_enrollment(request, auto_register=False):
Response
"""
user
=
request
.
user
action
=
request
.
POST
.
get
(
"enrollment_action"
)
if
'course_id'
not
in
request
.
POST
:
return
HttpResponseBadRequest
(
_
(
"Course id not specified"
))
course_id
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
request
.
POST
.
get
(
"course_id"
))
# TODO (ECOM-16): Remove this once the auto-registration A/B test completes
# If a user is in the experimental condition (auto-registration enabled),
# immediately set a session flag so they stay in the experimental condition.
...
...
@@ -630,13 +638,13 @@ def change_enrollment(request, auto_register=False):
if
request
.
session
.
get
(
'auto_register'
)
and
not
auto_register
:
auto_register
=
True
user
=
request
.
user
action
=
request
.
POST
.
get
(
"enrollment_action"
)
if
'course_id'
not
in
request
.
POST
:
return
HttpResponseBadRequest
(
_
(
"Course id not specified"
))
course_id
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
request
.
POST
.
get
(
"course_id"
))
# TODO (ECOM-16): Remove this once the auto-registration A/B test completes
# We've agreed to exclude certain courses from the A/B test. If we find ourselves
# registering for one of these courses, immediately switch to the control.
if
unicode
(
course_id
)
in
getattr
(
settings
,
'AUTO_REGISTRATION_AB_TEST_EXCLUDE_COURSES'
,
[])
:
auto_register
=
False
if
'auto_register'
in
request
.
session
:
del
request
.
session
[
'auto_register'
]
if
not
user
.
is_authenticated
():
return
HttpResponseForbidden
()
...
...
lms/envs/aws.py
View file @
9d4bf890
...
...
@@ -445,3 +445,6 @@ OPTIMIZELY_PROJECT_ID = AUTH_TOKENS.get('OPTIMIZELY_PROJECT_ID', OPTIMIZELY_PROJ
#### Course Registration Code length ####
REGISTRATION_CODE_LENGTH
=
ENV_TOKENS
.
get
(
'REGISTRATION_CODE_LENGTH'
,
8
)
# TODO (ECOM-16): Remove once the A/B test of auto-registration completes
AUTO_REGISTRATION_AB_TEST_EXCLUDE_COURSES
=
set
(
ENV_TOKENS
.
get
(
'AUTO_REGISTRATION_AB_TEST_EXCLUDE_COURSES'
,
AUTO_REGISTRATION_AB_TEST_EXCLUDE_COURSES
))
lms/envs/common.py
View file @
9d4bf890
...
...
@@ -1729,3 +1729,21 @@ OPENID_DOMAIN_PREFIX = 'openid:'
ANALYTICS_DATA_URL
=
""
ANALYTICS_DATA_TOKEN
=
""
ANALYTICS_DASHBOARD_URL
=
""
# TODO (ECOM-16): Remove once the A/B test of auto-registration completes
AUTO_REGISTRATION_AB_TEST_EXCLUDE_COURSES
=
set
([
"HarvardX/SW12.2x/1T2014"
,
"HarvardX/SW12.3x/1T2014"
,
"HarvardX/SW12.4x/1T2014"
,
"HarvardX/SW12.5x/2T2014"
,
"HarvardX/SW12.6x/2T2014"
,
"HarvardX/HUM2.1x/3T2014"
,
"HarvardX/SW12x/2013_SOND"
,
"LinuxFoundationX/LFS101x/2T2014"
,
"HarvardX/CS50x/2014_T1"
,
"HarvardX/AmPoX.1/2014_T3"
,
"HarvardX/SW12.7x/3T2014"
,
"HarvardX/SW12.10x/1T2015"
,
"HarvardX/SW12.9x/3T2014"
,
"HarvardX/SW12.8x/3T2014"
,
])
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