Skip to content

Commit

Permalink
Show send_at on archive page for scheduled campaigns. Closes #1036.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Nov 18, 2022
1 parent 832a426 commit 1e90fee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/archive.go
Expand Up @@ -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"`
}

Expand Down Expand Up @@ -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,
})
}
Expand Down
2 changes: 1 addition & 1 deletion queries.sql
Expand Up @@ -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;

Expand Down
8 changes: 7 additions & 1 deletion static/public/templates/archive.html
Expand Up @@ -7,7 +7,13 @@ <h2>{{ L.T "public.archiveTitle" }}</h2>
{{ 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>
Expand Down

0 comments on commit 1e90fee

Please sign in to comment.