From e283f3f046d4cae7db5320e43aacb19280588672 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 2 Dec 2015 11:18:18 -0700 Subject: [PATCH] Stop creating unnecessary characteristic --- app/pods/protected/strains/edit/controller.js | 4 +--- app/pods/protected/strains/strain-form/component.js | 10 +++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/pods/protected/strains/edit/controller.js b/app/pods/protected/strains/edit/controller.js index a9e48f3..509b1e7 100644 --- a/app/pods/protected/strains/edit/controller.js +++ b/app/pods/protected/strains/edit/controller.js @@ -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'); }, }, diff --git a/app/pods/protected/strains/strain-form/component.js b/app/pods/protected/strains/strain-form/component.js index 5a91dfc..f0fbab7 100644 --- a/app/pods/protected/strains/strain-form/component.js +++ b/app/pods/protected/strains/strain-form/component.js @@ -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); },