From 060b09ea0cafcdf7863b1aa6bc7f1e49f8466869 Mon Sep 17 00:00:00 2001 From: sylflo Date: Wed, 11 Aug 2021 21:27:27 +0200 Subject: [PATCH 1/4] add completed date for archive campaigns table --- static/js/src/app/campaigns.js | 1 + templates/campaigns.html | 1 + 2 files changed, 2 insertions(+) diff --git a/static/js/src/app/campaigns.js b/static/js/src/app/campaigns.js index e98d8bd8..f05070f3 100644 --- a/static/js/src/app/campaigns.js +++ b/static/js/src/app/campaigns.js @@ -381,6 +381,7 @@ $(document).ready(function () { var row = [ escapeHtml(campaign.name), moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a'), + moment(campaign.completed_date).format('MMMM Do YYYY, h:mm:ss a'), "" + campaign.status + "", "
\ \ diff --git a/templates/campaigns.html b/templates/campaigns.html index 7c12c9c2..78794631 100644 --- a/templates/campaigns.html +++ b/templates/campaigns.html @@ -61,6 +61,7 @@ Name Created Date + Completed Date Status From 097a6dd800bda7e9c4c314266422c2e98fbaaca5 Mon Sep 17 00:00:00 2001 From: sylflo Date: Wed, 11 Aug 2021 21:54:31 +0200 Subject: [PATCH 2/4] add completed Date for dahsboard table --- static/js/src/app/dashboard.js | 16 +++++++++------- templates/dashboard.html | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/static/js/src/app/dashboard.js b/static/js/src/app/dashboard.js index 66f705a1..402afc1c 100644 --- a/static/js/src/app/dashboard.js +++ b/static/js/src/app/dashboard.js @@ -303,23 +303,23 @@ $(document).ready(function () { }, { className: "color-sent", - targets: [2] - }, - { - className: "color-opened", targets: [3] }, { - className: "color-clicked", + className: "color-opened", targets: [4] }, { - className: "color-success", + className: "color-clicked", targets: [5] }, { - className: "color-reported", + className: "color-success", targets: [6] + }, + { + className: "color-reported", + targets: [7] } ], order: [ @@ -329,6 +329,7 @@ $(document).ready(function () { campaignRows = [] $.each(campaigns, function (i, campaign) { var campaign_date = moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a') + var completed_date = () => (campaign.status === "Completed" ? moment(campaign.completed_date).format('MMMM Do YYYY, h:mm:ss a') : '') var label = statuses[campaign.status].label || "label-default"; //section for tooltips on the status of a campaign to show some quick stats var launchDate; @@ -343,6 +344,7 @@ $(document).ready(function () { campaignRows.push([ escapeHtml(campaign.name), campaign_date, + completed_date, campaign.stats.sent, campaign.stats.opened, campaign.stats.clicked, diff --git a/templates/dashboard.html b/templates/dashboard.html index de3032bc..66d2605c 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -40,6 +40,7 @@ Name Created Date + Completed Date From 2aa0a725e0fc73ad335f15fe179133eb33e6d9a2 Mon Sep 17 00:00:00 2001 From: sylflo Date: Wed, 11 Aug 2021 22:17:18 +0200 Subject: [PATCH 3/4] add event when campaign is completed --- models/campaign.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/campaign.go b/models/campaign.go index a9e24382..bba35919 100644 --- a/models/campaign.go +++ b/models/campaign.go @@ -665,5 +665,10 @@ func CompleteCampaign(id int64, uid int64) error { if err != nil { log.Error(err) } + // Add event + err = AddEvent(&Event{Message: "Campaign Completed"}, c.Id) + if err != nil { + log.Error(err) + } return err } From 78aa421f89450643d2af243a66b87e645b9a2698 Mon Sep 17 00:00:00 2001 From: Sylvain Chateau Date: Sat, 25 Jun 2022 12:00:10 +0200 Subject: [PATCH 4/4] add condition to show completed date only for archived campaign --- static/js/src/app/campaigns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/src/app/campaigns.js b/static/js/src/app/campaigns.js index f05070f3..c56deda3 100644 --- a/static/js/src/app/campaigns.js +++ b/static/js/src/app/campaigns.js @@ -381,7 +381,6 @@ $(document).ready(function () { var row = [ escapeHtml(campaign.name), moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a'), - moment(campaign.completed_date).format('MMMM Do YYYY, h:mm:ss a'), "" + campaign.status + "", "" ] if (campaign.status == 'Completed') { + row.splice(2, 0, moment(campaign.completed_date).format('MMMM Do YYYY, h:mm:ss a')); rows['archived'].push(row) } else { rows['active'].push(row)