nutritionix / nutrition-label

Create a FDA-style nutrition label with any nutrition data source (even the Nutritionix API - http://www.nutritionix.com/api)
http://www.nutritionix.com/
MIT License
176 stars 66 forks source link

Bug on the previous value when the user entered an invalid value #53

Closed majin22 closed 8 years ago

majin22 commented 8 years ago

reported by https://github.com/pzykoh

http://dev2.nutritionix.com/boston-market/menu/special-diets/premium?allergens=eggs,fish,gluten,milk,peanuts,soy,tree_nuts,wheat

​- Click the more info of Rotisserie Chicken - Half Chicken​, The default serving size is 10.1oz, when you change the decimal value into a letter (ex: 10.a), then click anywhere on the label, instead of the value returning to 10.1, it returns to 10.


I've made a quick test and here are the results:

Original Value: 12.34

Change Value = Resulted Value
a2.34             = 12.34
1a.34             = 1
12.a4             = 12
12.3a             = 12.3
12.34a            = 12.34

this is related to the changes made for version 6.0.13 - May 2, 2016

New Feature: when a user enters an invalid value on the quantity textbox, the label now replace it with the previous valid value and not 1.0