Skip to content

Commit

Permalink
drop email_addresses subquery
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Nov 20, 2019
1 parent 72c43db commit dfcb9e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions db/DB.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,7 @@ const DB = {
},

async getPreFxaSubscribers() {
// We don't want to get subscribers records where the email address has
// since been added "under" an FxA subscription
const allEmailAddressesSubquery = knex("email_addresses").select("email");
const preFxaSubscribers = await knex("subscribers").whereRaw(
"(fxa_uid = '') IS NOT FALSE"
).andWhere(
"primary_email", "not in", allEmailAddressesSubquery
);
return preFxaSubscribers;
return await knex("subscribers").whereRaw("(fxa_uid = '') IS NOT FALSE");
},

async getSubscriberByEmail(email) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/send-email-to-pre-fxa-subscribers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { LocaleUtils } = require ("../locale-utils");
EmailUtils.init();

const subscribers = await DB.getPreFxaSubscribers();
console.log(`Found ${subscribers.length} pre-FxA subscribers whose email hasn't been added to an FxA subscription.`);
console.log(`Found ${subscribers.length} subscriber records with empty fxa_uid.`);
const notifiedSubscribers = [];
const utmID = "pre-fxa";
for (const subscriber of subscribers) {
Expand Down

0 comments on commit dfcb9e0

Please sign in to comment.