Hi,
I have a model that has a property which uses the difference macro to, obviously, get the difference between two of the model's properties. Here it is:
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';
import EmberCPM from 'ember-cpm';
const { Macros: { difference } } = EmberCPM;
export default Model.extend({
business: belongsTo(),
invoices: hasMany(),
payments: attr('number'),
totalBilled: attr('number'),
unpaid: difference('totalBilled', 'payments')
});
Strangely, I'm getting a NaN for the unpaid property when totalBilled = 15 and payments = 0. Digging into the macro itself, I'm seeing that firstNumber is properly set to 15, but secondNumber is actually the name of the property, payments, rather than 0. Odd, right?
If I downgrade to v2.1.3 of ember-cpm, everything works as expected.
I'm running Ember 2.11.3.
Thanks in advance for any help!
Hi,
I have a model that has a property which uses the
differencemacro to, obviously, get the difference between two of the model's properties. Here it is:Strangely, I'm getting a
NaNfor theunpaidproperty whentotalBilled = 15andpayments = 0. Digging into the macro itself, I'm seeing thatfirstNumberis properly set to15, butsecondNumberis actually the name of the property,payments, rather than0. Odd, right?If I downgrade to v2.1.3 of ember-cpm, everything works as expected.
I'm running Ember 2.11.3.
Thanks in advance for any help!