mirror of
https://github.com/warmbly/warmbly.git
synced 2026-10-31 08:13:49 +00:00
feat: count campaign progress emails_sent through the existing sequences join and return the restore context error when ANALYZE is cancelled
This commit is contained in:
@@ -306,6 +306,9 @@ func runRestore(ctx context.Context, args []string) error {
|
||||
}
|
||||
fmt.Println(" database restored")
|
||||
if err := analyzeDatabase(ctx, dsn); err != nil {
|
||||
if ctx.Err() != nil {
|
||||
return ctx.Err()
|
||||
}
|
||||
warn("the database restored, but ANALYZE did not finish, so queries plan without statistics until autovacuum gathers them. Run ANALYZE by hand:\n%s", err)
|
||||
} else {
|
||||
fmt.Println(" statistics analyzed")
|
||||
|
||||
@@ -1148,7 +1148,7 @@ func (r *campaignProgressRepository) GetCampaignProgress(ctx context.Context, ca
|
||||
SELECT
|
||||
(SELECT COUNT(DISTINCT contact_id) FROM campaign_leads WHERE campaign_id = $1) AS total_contacts,
|
||||
(SELECT COUNT(*) FROM sequences WHERE campaign_id = $1 AND kind = 'email') AS total_sequences,
|
||||
COUNT(*) FILTER (WHERE ccp.sent_at IS NOT NULL AND ` + progressIsEmailStep("ccp") + `) AS emails_sent,
|
||||
COUNT(*) FILTER (WHERE ccp.sent_at IS NOT NULL AND es.id IS NOT NULL) AS emails_sent,
|
||||
COUNT(*) FILTER (WHERE ccp.opened_at IS NOT NULL AND NOT ccp.opened_machine) AS emails_opened,
|
||||
COUNT(*) FILTER (WHERE ccp.clicked_at IS NOT NULL) AS emails_clicked,
|
||||
COUNT(*) FILTER (WHERE ccp.replied_at IS NOT NULL) AS emails_replied,
|
||||
|
||||
Reference in New Issue
Block a user