mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Fixed milestone query for imported members not using correct date
refs https://www.notion.so/ghost/Marketing-Milestone-email-campaigns-1d2c9dee3cfa4029863edb16092ad5c4?pvs=4 - I was passing in the days threshold of 7 to compare with the `created_at` value instead of creating an actual new data to compare
This commit is contained in:
parent
9852c21ec5
commit
314b88cfb5
@ -31,10 +31,13 @@ module.exports = class MilestoneQueries {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async hasImportedMembersInPeriod() {
|
||||
const importedThreshold = new Date();
|
||||
importedThreshold.setDate(importedThreshold.getDate() - MIN_DAYS_SINCE_IMPORTED);
|
||||
|
||||
const [hasImportedMembers] = await this.#db.knex('members_subscribe_events')
|
||||
.count('id as count')
|
||||
.where('source', '=', 'import')
|
||||
.where('created_at', '>=', MIN_DAYS_SINCE_IMPORTED);
|
||||
.where('created_at', '>=', importedThreshold);
|
||||
|
||||
return hasImportedMembers?.count > 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user