Minor bug fixes

This commit is contained in:
Chris Anderson 2023-04-07 14:52:50 -04:00
parent 2b437197b1
commit 60802584b2
2 changed files with 6 additions and 6 deletions

View file

@ -5,7 +5,7 @@ import List from '../lists/List'
import Template from '../render/Template'
import Subscription from '../subscriptions/Subscription'
export type CampaignState = 'draft' | 'pending' | 'scheduled' | 'running' | 'finished' | 'aborted'
export type CampaignState = 'draft' | 'scheduled' | 'pending' | 'running' | 'finished' | 'aborted'
export interface CampaignDelivery {
sent: number
total: number

View file

@ -348,11 +348,11 @@ export const campaignProgress = async (campaign: Campaign): Promise<CampaignProg
.select(CampaignSend.raw("SUM(IF(state = 'sent', 1, 0)) AS sent, SUM(IF(state = 'pending', 1, 0)) AS pending, COUNT(*) AS total, SUM(IF(opened_at IS NOT NULL, 1, 0)) AS opens, SUM(IF(clicks > 0, 1, 0)) AS clicks"))
.first()
return {
sent: parseInt(progress.sent),
pending: parseInt(progress.pending),
total: parseInt(progress.total),
opens: parseInt(progress.opens),
clicks: parseInt(progress.clicks),
sent: parseInt(progress.sent ?? 0),
pending: parseInt(progress.pending ?? 0),
total: parseInt(progress.total ?? 0),
opens: parseInt(progress.opens ?? 0),
clicks: parseInt(progress.clicks ?? 0),
}
}