mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Fixed members with multiple subscriptions receiving multiple newsletters
closes https://github.com/TryGhost/Ghost/issues/12259 - adds a `DISTINCT` to the query used to fetch member rows when generating an email recipient list - this increases query time 2.7s vs 1.6s locally with ~94k paid members but once the `members.paid` column is implemented this slow query can be removed
This commit is contained in:
parent
b27faeb138
commit
4f211d025d
1 changed files with 1 additions and 1 deletions
|
@ -271,7 +271,7 @@ async function getEmailMemberRows({emailModel, options}) {
|
||||||
debug('getEmailMemberRows: retrieving members list');
|
debug('getEmailMemberRows: retrieving members list');
|
||||||
// select('members.*') is necessary here to avoid duplicate `email` columns in the result set
|
// select('members.*') is necessary here to avoid duplicate `email` columns in the result set
|
||||||
// without it we do `select *` which pulls in the Stripe customer email too which overrides the member email
|
// without it we do `select *` which pulls in the Stripe customer email too which overrides the member email
|
||||||
const memberRows = await models.Member.getFilteredCollectionQuery(filterOptions).select('members.*');
|
const memberRows = await models.Member.getFilteredCollectionQuery(filterOptions).select('members.*').distinct();
|
||||||
debug(`getEmailMemberRows: retrieved members list - ${memberRows.length} members (${Date.now() - startRetrieve}ms)`);
|
debug(`getEmailMemberRows: retrieved members list - ${memberRows.length} members (${Date.now() - startRetrieve}ms)`);
|
||||||
|
|
||||||
return memberRows;
|
return memberRows;
|
||||||
|
|
Loading…
Reference in a new issue