From 17e81e6caa8d026aa63e341069f0eee2ba2e9e37 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Fri, 29 Jan 2016 12:34:29 -0600 Subject: [PATCH] Added event on sending email error. Fixes #99 --- models/models.go | 1 + static/js/app/campaign_results.js | 6 ++++++ worker/worker.go | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/models/models.go b/models/models.go index 326d326b..68c8d09c 100644 --- a/models/models.go +++ b/models/models.go @@ -30,6 +30,7 @@ const ( CAMPAIGN_EMAILS_SENT string = "Emails Sent" CAMPAIGN_COMPLETE string = "Completed" EVENT_SENT string = "Email Sent" + EVENT_SENDING_ERROR string = "Error Sending Email" EVENT_OPENED string = "Email Opened" EVENT_CLICKED string = "Clicked Link" STATUS_SUCCESS string = "Success" diff --git a/static/js/app/campaign_results.js b/static/js/app/campaign_results.js index 82dc22d3..06e127ce 100644 --- a/static/js/app/campaign_results.js +++ b/static/js/app/campaign_results.js @@ -32,6 +32,12 @@ var statuses = { label: "label-default", icon: "fa-times" }, + "Error Sending Email": { + slice: "ct-slice-donut-error", + legend: "ct-legend-error", + label: "label-default", + icon: "fa-times" + }, "Unknown": { slice: "ct-slice-donut-error", legend: "ct-legend-error", diff --git a/worker/worker.go b/worker/worker.go index a467b6d0..0044753b 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -115,6 +115,10 @@ func processCampaign(c *models.Campaign) { if err != nil { Logger.Println(err) } + err = c.AddEvent(models.Event{Email: t.Email, Message: models.EVENT_SENDING_ERROR}) + if err != nil { + Logger.Println(err) + } } else { err = t.UpdateStatus(models.EVENT_SENT) if err != nil {