Stop creating unnecessary characteristic

This commit is contained in:
Matthew Dillon 2015-12-02 11:18:18 -07:00
parent 0956ef3a25
commit e283f3f046
2 changed files with 4 additions and 10 deletions

View file

@ -55,9 +55,7 @@ export default Controller.extend({
},
addMeasurement: function() {
return this.store.createRecord('measurement', {
characteristic: this.store.createRecord('characteristic', { sortOrder: -999 }),
});
return this.store.createRecord('measurement');
},
},

View file

@ -117,13 +117,9 @@ export default Component.extend(SetupMetaData, {
this.set('isDirty', true);
},
deleteMeasurement: function(value) {
const characteristic = value.get('characteristic');
if (characteristic.get('isNew')) {
this.get('deleteQueue').pushObject(characteristic);
}
this.get('deleteQueue').pushObject(value);
this.get('measurements').removeObject(value);
deleteMeasurement: function(measurement) {
this.get('deleteQueue').pushObject(measurement);
this.get('measurements').removeObject(measurement);
this.set('isDirty', true);
},