0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Fixed members-click-event created_at time

no issue
The faker date method seems to spontaneously fail sometimes, as it had decided that the "later" time was before the opened time.
This commit is contained in:
Sam Lord 2023-02-20 13:36:40 +00:00
parent 923c522778
commit 744b92333c

View file

@ -32,6 +32,7 @@ class MembersClickEventsImporter extends TableImporter {
const openedAt = new Date(this.model.opened_at);
const laterOn = new Date(this.model.opened_at);
laterOn.setMinutes(laterOn.getMinutes() + 15);
const clickTime = new Date(openedAt.valueOf() + (Math.random() * (laterOn.valueOf() - openedAt.valueOf())));
return {
id: faker.database.mongodbObjectId(),
@ -40,7 +41,7 @@ class MembersClickEventsImporter extends TableImporter {
min: 0,
max: this.redirectList.length - 1
})].id,
created_at: dateToDatabaseString(faker.date.between(openedAt, laterOn))
created_at: dateToDatabaseString(clickTime)
};
}
}