mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Added emails sent in past 30 days from real endpoints to dashboard 5
refs https://github.com/TryGhost/Team/issues/1443 - Also fixed the open rate that was used in the email open rate chart - Calculate the total emails sent in the last 30 days
This commit is contained in:
parent
801a910f7d
commit
6e8bf040a9
2 changed files with 6 additions and 4 deletions
|
@ -39,9 +39,9 @@ export default class ChartEmailOpenRate extends Component {
|
|||
}
|
||||
|
||||
get chartData() {
|
||||
const stats = this.dashboardStats.emailOpenRateStats.filter(stat => stat.email.deliveredCount > 0);
|
||||
const stats = this.dashboardStats.emailOpenRateStats;
|
||||
const labels = stats.map(stat => stat.title);
|
||||
const data = stats.map(stat => stat.email.openedCount / stat.email.deliveredCount * 100);
|
||||
const data = stats.map(stat => stat.email.openRate);
|
||||
|
||||
return {
|
||||
labels,
|
||||
|
|
|
@ -379,8 +379,10 @@ export default class DashboardStatsService extends Service {
|
|||
this.emailsSent30d = this.dashboardMocks.emailsSent30d;
|
||||
return;
|
||||
}
|
||||
// Normal implementation
|
||||
// @todo
|
||||
|
||||
const start30d = new Date(Date.now() - 30 * 3600 * 1000);
|
||||
const result = yield this.store.query('email', {limit: 100, filter: 'submitted_at:>' + start30d.toISOString()});
|
||||
this.emailsSent30d = result.reduce((c, email) => c + email.emailCount, 0);
|
||||
}
|
||||
|
||||
loadEmailOpenRateStats() {
|
||||
|
|
Loading…
Add table
Reference in a new issue