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
8afc273d
Commit
8afc273d
authored
Jan 12, 2017
by
Jareer Ahsan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added username and user_id in opt out email csv.
ECOM-2963
parent
28e3b1cb
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 @
8afc273d
...
@@ -49,6 +49,8 @@ class Command(BaseCommand):
...
@@ -49,6 +49,8 @@ class Command(BaseCommand):
# Fields output in the CSV
# Fields output in the CSV
OUTPUT_FIELD_NAMES
=
[
OUTPUT_FIELD_NAMES
=
[
"user_id"
,
"username"
,
"email"
,
"email"
,
"full_name"
,
"full_name"
,
"course_id"
,
"course_id"
,
...
@@ -199,6 +201,8 @@ class Command(BaseCommand):
...
@@ -199,6 +201,8 @@ class Command(BaseCommand):
query
=
(
query
=
(
u"""
u"""
SELECT
SELECT
user.`id` AS `user_id`,
user.`username` AS username,
user.`email` AS `email`,
user.`email` AS `email`,
profile.`name` AS `full_name`,
profile.`name` AS `full_name`,
enrollment.`course_id` AS `course_id`,
enrollment.`course_id` AS `course_id`,
...
@@ -234,8 +238,10 @@ class Command(BaseCommand):
...
@@ -234,8 +238,10 @@ class Command(BaseCommand):
cursor
.
execute
(
query
)
cursor
.
execute
(
query
)
row_count
=
0
row_count
=
0
for
row
in
self
.
_iterate_results
(
cursor
):
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
({
writer
.
writerow
({
"user_id"
:
user_id
,
"username"
:
username
.
encode
(
'utf-8'
),
"email"
:
email
.
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
# There should not be a case where users are without full_names. We only need this safe check because
# of ECOM-1995.
# of ECOM-1995.
...
...
openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py
View file @
8afc273d
...
@@ -37,6 +37,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
...
@@ -37,6 +37,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
OUTPUT_FILE_NAME
=
"test_org_email_opt_in.csv"
OUTPUT_FILE_NAME
=
"test_org_email_opt_in.csv"
OUTPUT_FIELD_NAMES
=
[
OUTPUT_FIELD_NAMES
=
[
"user_id"
,
"username"
,
"email"
,
"email"
,
"full_name"
,
"full_name"
,
"course_id"
,
"course_id"
,
...
@@ -401,6 +403,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
...
@@ -401,6 +403,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
# Check the header row
# Check the header row
self
.
assertEqual
({
self
.
assertEqual
({
"user_id"
:
"user_id"
,
"username"
:
"username"
,
"email"
:
"email"
,
"email"
:
"email"
,
"full_name"
:
"full_name"
,
"full_name"
:
"full_name"
,
"course_id"
:
"course_id"
,
"course_id"
:
"course_id"
,
...
@@ -411,6 +415,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
...
@@ -411,6 +415,8 @@ class EmailOptInListTest(ModuleStoreTestCase):
# Check data rows
# Check data rows
for
user
,
course_id
,
opt_in_pref
in
args
:
for
user
,
course_id
,
opt_in_pref
in
args
:
self
.
assertIn
({
self
.
assertIn
({
"user_id"
:
str
(
user
.
id
),
"username"
:
user
.
username
.
encode
(
'utf-8'
),
"email"
:
user
.
email
.
encode
(
'utf-8'
),
"email"
:
user
.
email
.
encode
(
'utf-8'
),
"full_name"
:
(
"full_name"
:
(
user
.
profile
.
name
.
encode
(
'utf-8'
)
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