Fixed issue with incomplete campaign creation with large user counts. Fixes #436. Fixes #368

pull/414/merge
Jordan Wright 2016-11-18 22:01:38 -06:00
parent 3a37849324
commit 43cbc1d65f
2 changed files with 5 additions and 2 deletions

View File

@ -251,7 +251,7 @@ func PostCampaign(c *Campaign, uid int64) error {
c.UserId = uid c.UserId = uid
c.CreatedDate = time.Now() c.CreatedDate = time.Now()
c.CompletedDate = time.Time{} c.CompletedDate = time.Time{}
c.Status = CAMPAIGN_QUEUED c.Status = CAMPAIGN_CREATED
if c.LaunchDate.IsZero() { if c.LaunchDate.IsZero() {
c.LaunchDate = time.Now() c.LaunchDate = time.Now()
} }
@ -323,7 +323,9 @@ func PostCampaign(c *Campaign, uid int64) error {
c.Results = append(c.Results, *r) c.Results = append(c.Results, *r)
} }
} }
return nil c.Status = CAMPAIGN_QUEUED
err = db.Save(c).Error
return err
} }
//DeleteCampaign deletes the specified campaign //DeleteCampaign deletes the specified campaign

View File

@ -27,6 +27,7 @@ var Logger = log.New(os.Stdout, " ", log.Ldate|log.Ltime|log.Lshortfile)
const ( const (
CAMPAIGN_IN_PROGRESS string = "In progress" CAMPAIGN_IN_PROGRESS string = "In progress"
CAMPAIGN_QUEUED string = "Queued" CAMPAIGN_QUEUED string = "Queued"
CAMPAIGN_CREATED string = "Created"
CAMPAIGN_EMAILS_SENT string = "Emails Sent" CAMPAIGN_EMAILS_SENT string = "Emails Sent"
CAMPAIGN_COMPLETE string = "Completed" CAMPAIGN_COMPLETE string = "Completed"
EVENT_SENT string = "Email Sent" EVENT_SENT string = "Email Sent"