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'), |   testMethod: DS.attr('string'), | ||||||
|   createdAt: DS.attr('date'), |   createdAt: DS.attr('date'), | ||||||
|   updatedAt: 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() { |   computedValue: Ember.computed('textMeasurementType', 'txtValue', 'numValue', function() { | ||||||
|     var val; |     var val; | ||||||
|     if (this.get('textMeasurementType')) { |     if (this.get('computedType') == 'Fixed-text') { | ||||||
|       val = this.get('textMeasurementType'); |       val = this.get('textMeasurementType'); | ||||||
|     } else if (this.get('txtValue')) { |     } else if (this.get('computedType') == 'Free-text') { | ||||||
|       val = this.get('txtValue'); |       val = this.get('txtValue'); | ||||||
|     } else if (this.get('numValue')) { |     } else if (this.get('computedType') == 'Numerical') { | ||||||
|       val = this.get('numValue'); |       val = this.get('numValue'); | ||||||
|       if (this.get('confidenceInterval')) { |       if (this.get('confidenceInterval')) { | ||||||
|         val = val + ' ± ' + this.get('confidenceInterval'); |         val = val + ' ± ' + this.get('confidenceInterval'); | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| <td>{{measurement.characteristic}}</td> | <td>{{measurement.characteristic}}</td> | ||||||
|  | <td>{{measurement.computedType}}</td> | ||||||
| <td>{{{measurement.computedValue}}}</td> | <td>{{{measurement.computedValue}}}</td> | ||||||
| <td>{{measurement.notes}}</td> | <td>{{measurement.notes}}</td> | ||||||
| <td>{{measurement.testMethod}}</td> | <td>{{measurement.testMethod}}</td> | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
|   <thead> |   <thead> | ||||||
|     <tr> |     <tr> | ||||||
|       <th>Characteristic</th> |       <th>Characteristic</th> | ||||||
|  |       <th>Measurement Type</th> | ||||||
|       <th>Measurement</th> |       <th>Measurement</th> | ||||||
|       <th>Notes</th> |       <th>Notes</th> | ||||||
|       <th>Test Method</th> |       <th>Test Method</th> | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Matthew Dillon
						Matthew Dillon