mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
a2a98b575f
no issue - added "Sends" and "Opens" columns to the posts list to see newsletter performance at a glance - "Sends" will show the type of members sent to (free, paid, all) as a tooltip - "Opens" shows open rate by default and total opens on hover
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
import Model, {attr, belongsTo} from '@ember-data/model';
|
|
import {computed} from '@ember/object';
|
|
import {equal} from '@ember/object/computed';
|
|
|
|
export default Model.extend({
|
|
error: attr('string'),
|
|
html: attr('string'),
|
|
plaintext: attr('string'),
|
|
stats: attr('json-string'),
|
|
status: attr('string'),
|
|
subject: attr('string'),
|
|
submittedAtUTC: attr('moment-utc'),
|
|
uuid: attr('string'),
|
|
recipientFilter: attr('string'),
|
|
|
|
emailCount: attr('number', {defaultValue: 0}),
|
|
deliveredCount: attr('number', {defaultValue: 0}),
|
|
openedCount: attr('number', {defaultValue: 0}),
|
|
failedCount: attr('number', {defaultValue: 0}),
|
|
|
|
trackOpens: attr('boolean'),
|
|
|
|
createdAtUTC: attr('moment-utc'),
|
|
createdBy: attr('string'),
|
|
updatedAtUTC: attr('moment-utc'),
|
|
updatedBy: attr('string'),
|
|
|
|
post: belongsTo('post'),
|
|
|
|
isSuccess: equal('status', 'submitted'),
|
|
isFailure: equal('status', 'failed'),
|
|
|
|
openRate: computed('emailCount', 'openedCount', function () {
|
|
let {emailCount, openedCount} = this;
|
|
|
|
if (emailCount === 0) {
|
|
return 0;
|
|
}
|
|
|
|
return Math.round(openedCount / emailCount * 100);
|
|
}),
|
|
|
|
retry() {
|
|
return this.store.adapterFor('email').retry(this);
|
|
}
|
|
});
|