strange issue when using difference in 3.0
- Dominant language
- JavaScript
- Stars
- 276
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
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:
```js
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!
Contributor guide
Assessment
This issue has not been assessed yet.