Adding computedType to measurements
This commit is contained in:
		
							parent
							
								
									38a382279a
								
							
						
					
					
						commit
						ddc306ef29
					
				
					 3 changed files with 16 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -13,13 +13,24 @@ export default DS.Model.extend({
 | 
			
		|||
  testMethod: DS.attr('string'),
 | 
			
		||||
  createdAt: DS.attr('date'),
 | 
			
		||||
  updatedAt: DS.attr('date'),
 | 
			
		||||
  computedType: Ember.computed('textMeasurementType', 'txtValue', 'numValue', function() {
 | 
			
		||||
    if (this.get('textMeasurementType') && !this.get('txtValue') && !this.get('numValue')) {
 | 
			
		||||
      return 'Fixed-text';
 | 
			
		||||
    } else if (!this.get('textMeasurementType') && this.get('txtValue') && !this.get('numValue')) {
 | 
			
		||||
      return 'Free-text';
 | 
			
		||||
    } else if (!this.get('textMeasurementType') && !this.get('txtValue') && this.get('numValue')) {
 | 
			
		||||
      return 'Numerical';
 | 
			
		||||
    } else {
 | 
			
		||||
      return "error";
 | 
			
		||||
    }
 | 
			
		||||
  }),
 | 
			
		||||
  computedValue: Ember.computed('textMeasurementType', 'txtValue', 'numValue', function() {
 | 
			
		||||
    var val;
 | 
			
		||||
    if (this.get('textMeasurementType')) {
 | 
			
		||||
    if (this.get('computedType') == 'Fixed-text') {
 | 
			
		||||
      val = this.get('textMeasurementType');
 | 
			
		||||
    } else if (this.get('txtValue')) {
 | 
			
		||||
    } else if (this.get('computedType') == 'Free-text') {
 | 
			
		||||
      val = this.get('txtValue');
 | 
			
		||||
    } else if (this.get('numValue')) {
 | 
			
		||||
    } else if (this.get('computedType') == 'Numerical') {
 | 
			
		||||
      val = this.get('numValue');
 | 
			
		||||
      if (this.get('confidenceInterval')) {
 | 
			
		||||
        val = val + ' ± ' + this.get('confidenceInterval');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
<td>{{measurement.characteristic}}</td>
 | 
			
		||||
<td>{{measurement.computedType}}</td>
 | 
			
		||||
<td>{{{measurement.computedValue}}}</td>
 | 
			
		||||
<td>{{measurement.notes}}</td>
 | 
			
		||||
<td>{{measurement.testMethod}}</td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
  <thead>
 | 
			
		||||
    <tr>
 | 
			
		||||
      <th>Characteristic</th>
 | 
			
		||||
      <th>Measurement Type</th>
 | 
			
		||||
      <th>Measurement</th>
 | 
			
		||||
      <th>Notes</th>
 | 
			
		||||
      <th>Test Method</th>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue