mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Fixed email count check in email-analytics service
no issue - raw knex `.count()` does not return a straight number, we need to handle an array of rowDataPacket objects
This commit is contained in:
parent
0e46898aaa
commit
249fd4f06a
1 changed files with 4 additions and 4 deletions
|
@ -22,8 +22,8 @@ class EmailAnalyticsService {
|
|||
async fetchAll() {
|
||||
const result = new EventProcessingResult();
|
||||
|
||||
const emailCount = await this.db.knex('emails').count();
|
||||
if (emailCount <= 0) {
|
||||
const [emailCount] = await this.db.knex('emails').count('id as count');
|
||||
if (emailCount && emailCount.count <= 0) {
|
||||
debug('fetchAll: skipping - no emails to track');
|
||||
return result;
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ class EmailAnalyticsService {
|
|||
const result = new EventProcessingResult();
|
||||
const lastTimestamp = await this.getLastSeenEventTimestamp();
|
||||
|
||||
const emailCount = await this.db.knex('emails').count();
|
||||
if (emailCount <= 0) {
|
||||
const [emailCount] = await this.db.knex('emails').count('id as count');
|
||||
if (emailCount && emailCount.count <= 0) {
|
||||
debug('fetchLatest: skipping - no emails to track');
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue