From 43cbc1d65ffcac7c95198692e2f86dcfa9639944 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Fri, 18 Nov 2016 22:01:38 -0600 Subject: [PATCH] Fixed issue with incomplete campaign creation with large user counts. Fixes #436. Fixes #368 --- models/campaign.go | 6 ++++-- models/models.go | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/models/campaign.go b/models/campaign.go index 8f16a46e..875fc0c0 100644 --- a/models/campaign.go +++ b/models/campaign.go @@ -251,7 +251,7 @@ func PostCampaign(c *Campaign, uid int64) error { c.UserId = uid c.CreatedDate = time.Now() c.CompletedDate = time.Time{} - c.Status = CAMPAIGN_QUEUED + c.Status = CAMPAIGN_CREATED if c.LaunchDate.IsZero() { c.LaunchDate = time.Now() } @@ -323,7 +323,9 @@ func PostCampaign(c *Campaign, uid int64) error { c.Results = append(c.Results, *r) } } - return nil + c.Status = CAMPAIGN_QUEUED + err = db.Save(c).Error + return err } //DeleteCampaign deletes the specified campaign diff --git a/models/models.go b/models/models.go index 007216be..580da4d3 100644 --- a/models/models.go +++ b/models/models.go @@ -27,6 +27,7 @@ var Logger = log.New(os.Stdout, " ", log.Ldate|log.Ltime|log.Lshortfile) const ( CAMPAIGN_IN_PROGRESS string = "In progress" CAMPAIGN_QUEUED string = "Queued" + CAMPAIGN_CREATED string = "Created" CAMPAIGN_EMAILS_SENT string = "Emails Sent" CAMPAIGN_COMPLETE string = "Completed" EVENT_SENT string = "Email Sent"