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
7baecd3a
Commit
7baecd3a
authored
Jan 18, 2017
by
jareerahsan
Committed by
GitHub
Jan 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14317 from edx/jareer/ecom-2963-added-new-fields-in-email-opt-out
Added username and user_id in opt out email csv.
parents
09030734
8afc273d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py
+7
-1
openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py
+6
-0
No files found.
openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py
View file @
7baecd3a
...
...
@@ -49,6 +49,8 @@ class Command(BaseCommand):
# Fields output in the CSV
OUTPUT_FIELD_NAMES
=
[
"user_id"
,
"username"
,
"email"
,
"full_name"
,
"course_id"
,
...
...
@@ -199,6 +201,8 @@ class Command(BaseCommand):
query
=
(
u"""
SELECT
user.`id` AS `user_id`,
user.`username` AS username,
user.`email` AS `email`,
profile.`name` AS `full_name`,
enrollment.`course_id` AS `course_id`,
...
...
@@ -234,8 +238,10 @@ class Command(BaseCommand):
cursor
.
execute
(
query
)
row_count
=
0
for
row
in
self
.
_iterate_results
(
cursor
):
email
,
full_name
,
course_id
,
is_opted_in
,
pref_set_datetime
=
row
user_id
,
username
,
email
,
full_name
,
course_id
,
is_opted_in
,
pref_set_datetime
=
row
writer
.
writerow
({
"user_id"
:
user_id
,
"username"
:
username
.
encode
(
'utf-8'
),
"email"
:
email
.
encode
(
'utf-8'
),
# There should not be a case where users are without full_names. We only need this safe check because
# of ECOM-1995.
...
...
openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py
View file @
7baecd3a
...
...
@@ -36,6 +36,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
OUTPUT_FILE_NAME
=
"test_org_email_opt_in.csv"
OUTPUT_FIELD_NAMES
=
[
"user_id"
,
"username"
,
"email"
,
"full_name"
,
"course_id"
,
...
...
@@ -400,6 +402,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
# Check the header row
self
.
assertEqual
({
"user_id"
:
"user_id"
,
"username"
:
"username"
,
"email"
:
"email"
,
"full_name"
:
"full_name"
,
"course_id"
:
"course_id"
,
...
...
@@ -410,6 +414,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
# Check data rows
for
user
,
course_id
,
opt_in_pref
in
args
:
self
.
assertIn
({
"user_id"
:
str
(
user
.
id
),
"username"
:
user
.
username
.
encode
(
'utf-8'
),
"email"
:
user
.
email
.
encode
(
'utf-8'
),
"full_name"
:
(
user
.
profile
.
name
.
encode
(
'utf-8'
)
...
...
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