Show send_at on archive page for scheduled campaigns. Closes #1036.

This commit is contained in:
Kailash Nadh 2022-11-18 23:12:53 +05:30
parent 832a426f4c
commit 1e90feecaf
3 changed files with 10 additions and 2 deletions

View file

@ -17,6 +17,7 @@ type campArchive struct {
UUID string `json:"uuid"`
Subject string `json:"subject"`
CreatedAt null.Time `json:"created_at"`
SendAt null.Time `json:"send_at"`
URL string `json:"url"`
}
@ -169,6 +170,7 @@ func getCampaignArchives(offset, limit int, app *App) ([]campArchive, int, error
UUID: camp.UUID,
Subject: camp.Subject,
CreatedAt: camp.CreatedAt,
SendAt: camp.SendAt,
URL: app.constants.ArchiveURL + "/" + camp.UUID,
})
}

View file

@ -517,7 +517,7 @@ SELECT campaigns.*,
WHERE CASE WHEN $1 > 0 THEN campaigns.id = $1 ELSE uuid = $2 END;
-- name: get-archived-campaigns
SELECT COUNT(*) OVER () AS total, id, uuid, subject, archive_meta, created_at FROM campaigns
SELECT COUNT(*) OVER () AS total, id, uuid, subject, archive_meta, created_at, send_at FROM campaigns
WHERE archive=true AND type='regular' AND status=ANY('{running, paused, finished}')
ORDER by created_at DESC OFFSET $1 LIMIT $2;

View file

@ -7,7 +7,13 @@
{{ range $c := .Data.Campaigns }}
<li>
<a href="{{ $c.URL }}">{{ $c.Subject }}</a>
<span class="date">{{ $c.CreatedAt.Time.Format "Mon, 02 Jan 2006" }}</span>
<span class="date">
{{ if $c.SendAt.Valid }}
{{ $c.SendAt.Time.Format "Mon, 02 Jan 2006" }}
{{ else }}
{{ $c.CreatedAt.Time.Format "Mon, 02 Jan 2006" }}
{{ end }}
</span>
</li>
{{ end }}
</ul>