Measurement row component

This commit is contained in:
Matthew Dillon 2015-03-19 10:02:42 -08:00
parent ced405cd03
commit c68f0a0fee
5 changed files with 55 additions and 17 deletions

View file

@ -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;
})
});