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
934207bf
Commit
934207bf
authored
Feb 20, 2015
by
Feanil Patel
Committed by
Sarina Canelake
Apr 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to get it working with master.
parent
5c0adf04
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
lms/djangoapps/mailing/management/commands/mailchimp_sync_course.py
+8
-5
lms/envs/common.py
+3
-0
requirements/edx/base.txt
+3
-0
No files found.
lms/djangoapps/mailing/management/commands/mailchimp_sync_course.py
View file @
934207bf
...
...
@@ -13,6 +13,7 @@ from django.core.management.base import BaseCommand, CommandError
from
mailsnake
import
MailSnake
from
student.models
import
UserProfile
,
unique_id_for_user
from
opaque_keys.edx.keys
import
CourseKey
BATCH_SIZE
=
15000
...
...
@@ -122,7 +123,7 @@ def verify_list(mailchimp, list_id, course_id):
def
get_student_data
(
students
,
exclude
=
None
):
# To speed the query, we won't retrieve the full User object, only
# two of its values. The namedtuple simulates the User object.
FakeUser
=
namedtuple
(
'Fake'
,
'id username'
)
FakeUser
=
namedtuple
(
'Fake'
,
'id username
is_anonymous
'
)
exclude
=
exclude
if
exclude
else
set
()
...
...
@@ -130,8 +131,9 @@ def get_student_data(students, exclude=None):
e
=
{
'EMAIL'
:
v
[
'user__email'
],
'FULLNAME'
:
v
[
'name'
]
.
title
()}
e
[
'EDX_ID'
]
=
unique_id_for_user
(
FakeUser
(
v
[
'user_id'
],
v
[
'user__username'
]))
fake_user
=
FakeUser
(
v
[
'user_id'
],
v
[
'user__username'
],
lambda
:
True
)
e
[
'EDX_ID'
]
=
unique_id_for_user
(
fake_user
)
return
e
fields
=
'user__email'
,
'name'
,
'user_id'
,
'user__username'
...
...
@@ -143,7 +145,8 @@ def get_student_data(students, exclude=None):
def
get_enrolled_students
(
course_id
):
objects
=
UserProfile
.
objects
students
=
objects
.
filter
(
user__courseenrollment__course_id
=
course_id
,
course_key
=
CourseKey
.
from_string
(
course_id
)
students
=
objects
.
filter
(
user__courseenrollment__course_id
=
course_key
,
user__courseenrollment__is_active
=
True
)
return
students
...
...
@@ -232,7 +235,7 @@ def subscribe_with_data(mailchimp, list_id, user_data):
double_optin
=
False
,
update_existing
=
True
)
log
.
debug
(
"Added: {} Error on: {}"
.
format
(
result
[
'add_count'
],
resu
r
t
[
'error_count'
]))
result
[
'add_count'
],
resu
l
t
[
'error_count'
]))
def
make_segments
(
mailchimp
,
list_id
,
count
,
emails
):
...
...
lms/envs/common.py
View file @
934207bf
...
...
@@ -1722,6 +1722,9 @@ INSTALLED_APPS = (
'openedx.core.djangoapps.content.course_structures'
,
'course_structure_api'
,
# Mailchimp Syncing
'mailing'
,
# CORS and cross-domain CSRF
'corsheaders'
,
'cors_csrf'
,
...
...
requirements/edx/base.txt
View file @
934207bf
...
...
@@ -149,3 +149,6 @@ testtools==0.9.34
# Used for Segment.io analytics
analytics-python==0.4.4
# Needed for mailchimp(mailing djangoapp)
mailsnake==1.6.2
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