Skip to content

Commit 1471cdb

Browse files
fix: Remove serialization of computed statistics (#3980)
1 parent aec0711 commit 1471cdb

File tree

6 files changed

+34
-47
lines changed

6 files changed

+34
-47
lines changed

app/controllers/admin/events/list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
6464
},
6565
{
6666
name : 'Sessions',
67-
valuePath : 'eventStatisticsGeneral',
67+
valuePath : 'generalStatistics',
6868
cellComponent : 'ui-table/cell/cell-sessions',
6969
width : 90
7070

7171
},
7272
{
7373
name : 'Speakers',
74-
valuePath : 'eventStatisticsGeneral',
74+
valuePath : 'generalStatistics',
7575
cellComponent : 'ui-table/cell/cell-speakers-dashboard',
7676
width : 90
7777
},

app/controllers/admin/users/view/events/list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
4141
},
4242
{
4343
name : 'Sessions',
44-
valuePath : 'eventStatisticsGeneral',
44+
valuePath : 'generalStatistics',
4545
width : 90,
4646
isSortable : false,
4747
cellComponent : 'ui-table/cell/cell-sessions-dashboard'
4848
},
4949
{
5050
name : 'Speakers',
51-
valuePath : 'eventStatisticsGeneral',
51+
valuePath : 'generalStatistics',
5252
cellComponent : 'ui-table/cell/cell-speakers-dashboard',
5353
isSortable : false
5454
},

app/controllers/events/list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
4343
},
4444
{
4545
name : 'Sessions',
46-
valuePath : 'eventStatisticsGeneral',
46+
valuePath : 'generalStatistics',
4747
cellComponent : 'ui-table/cell/cell-sessions-dashboard'
4848
},
4949
{
5050
name : 'Speakers',
51-
valuePath : 'eventStatisticsGeneral',
51+
valuePath : 'generalStatistics',
5252
cellComponent : 'ui-table/cell/cell-speakers-dashboard'
5353
},
5454
{

app/models/event.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,27 @@ export default ModelBase.extend(CustomPrimaryKeyMixin, {
9595
/**
9696
* Relationships
9797
*/
98-
type : belongsTo('event-type'),
99-
topic : belongsTo('event-topic'),
100-
subTopic : belongsTo('event-sub-topic'),
101-
location : belongsTo('event-location'),
102-
sessions : hasMany('session'),
103-
sponsors : hasMany('sponsor'),
104-
microlocations : hasMany('microlocation'),
105-
tracks : hasMany('track'),
106-
tickets : hasMany('ticket'),
107-
orders : hasMany('order'),
108-
socialLinks : hasMany('social-link'),
109-
emailNotifications : hasMany('email-notification'),
110-
speakers : hasMany('speaker'),
111-
invoice : hasMany('event-invoice'),
112-
speakersCall : belongsTo('speakers-call'),
113-
stripeAuthorization : belongsTo('stripe-authorization'),
114-
eventStatisticsGeneral : belongsTo('event-statistics-general'),
115-
tax : belongsTo('tax'),
116-
copyright : belongsTo('event-copyright'),
117-
sessionTypes : hasMany('session-type'),
118-
user : belongsTo('user', { inverse: 'events' }),
98+
type : belongsTo('event-type'),
99+
topic : belongsTo('event-topic'),
100+
subTopic : belongsTo('event-sub-topic'),
101+
location : belongsTo('event-location'),
102+
sessions : hasMany('session'),
103+
sponsors : hasMany('sponsor'),
104+
microlocations : hasMany('microlocation'),
105+
tracks : hasMany('track'),
106+
tickets : hasMany('ticket'),
107+
orders : hasMany('order'),
108+
socialLinks : hasMany('social-link'),
109+
emailNotifications : hasMany('email-notification'),
110+
speakers : hasMany('speaker'),
111+
invoice : hasMany('event-invoice'),
112+
speakersCall : belongsTo('speakers-call'),
113+
stripeAuthorization : belongsTo('stripe-authorization'),
114+
generalStatistics : belongsTo('event-statistics-general'),
115+
tax : belongsTo('tax'),
116+
copyright : belongsTo('event-copyright'),
117+
sessionTypes : hasMany('session-type'),
118+
user : belongsTo('user', { inverse: 'events' }),
119119

120120
customForms : hasMany('custom-form'),
121121
attendees : hasMany('attendee'),

app/routes/events/view/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class extends Route.extend(EmberTableRouteMixin) {
2222
roleInvites : await eventDetails.query('roleInvites', {}),
2323
sessionTypes : await eventDetails.query('sessionTypes', {}),
2424
socialLinks : await eventDetails.query('socialLinks', {}),
25-
statistics : await eventDetails.query('eventStatisticsGeneral', {}),
25+
statistics : await eventDetails.query('generalStatistics', {}),
2626
orderStat : await eventDetails.query('orderStatistics', {}),
2727
tickets : await eventDetails.query('tickets', {}),
2828
roles : await this.store.findAll('role')

app/serializers/event.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,13 @@ export default ApplicationSerializer.extend(CustomPrimaryKeyMixin, {
1010
subTopic : 'event-sub-topic',
1111
copyright : 'event-copyright'
1212
},
13-
normalize() {
14-
const payload = this._super(...arguments);
15-
payload.data = this.addLinks(payload.data);
16-
return payload;
17-
},
1813

19-
addLinks(event) {
20-
event.relationships.eventStatisticsGeneral = {
21-
links: {
22-
related : `/v1/events/${event.id}/general-statistics`,
23-
self : `/v1/events/${event.id}/general-statistics`
24-
}
25-
};
26-
event.relationships.orderStatistics = {
27-
links: {
28-
related : `/v1/events/${event.id}/order-statistics`,
29-
self : `/v1/events/${event.id}/order-statistics`
30-
}
31-
};
32-
return event;
14+
serialize() {
15+
const json = this._super(...arguments);
16+
delete json.data.relationships['general-statistics'];
17+
delete json.data.relationships['order-statistics'];
18+
19+
return json;
3320
}
3421

3522
});

0 commit comments

Comments
 (0)