diff --git a/app/components/measurements/measurement-row.js b/app/components/measurements/measurement-row.js new file mode 100644 index 0000000..cd27120 --- /dev/null +++ b/app/components/measurements/measurement-row.js @@ -0,0 +1,6 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + tagName: 'tr', + measurement: null, // passed in +}); diff --git a/app/models/measurement.js b/app/models/measurement.js index 671480b..ef58639 100644 --- a/app/models/measurement.js +++ b/app/models/measurement.js @@ -1,4 +1,5 @@ import DS from 'ember-data'; +import Ember from 'ember'; export default DS.Model.extend({ strain: DS.belongsTo('strain'), @@ -11,5 +12,24 @@ export default DS.Model.extend({ notes: DS.attr('string'), testMethod: DS.attr('string'), createdAt: DS.attr('date'), - updatedAt: DS.attr('date') + updatedAt: DS.attr('date'), + computedValue: Ember.computed('textMeasurementType', 'txtValue', 'numValue', function() { + var val; + if (this.get('textMeasurementType')) { + val = this.get('textMeasurementType'); + } else if (this.get('txtValue')) { + val = this.get('txtValue'); + } else if (this.get('numValue')) { + val = this.get('numValue'); + if (this.get('confidenceInterval')) { + val = val + ' ± ' + this.get('confidenceInterval'); + } + } else { + val = "error"; + } + if (this.get('unitType')) { + val = val + ' ' + this.get('unitType'); + } + return val; + }) }); diff --git a/app/templates/components/measurements/measurement-row.hbs b/app/templates/components/measurements/measurement-row.hbs new file mode 100644 index 0000000..3adb708 --- /dev/null +++ b/app/templates/components/measurements/measurement-row.hbs @@ -0,0 +1,4 @@ +