moggie/Spartan — Issue #3: Add Food Allowing Non-Valid Values
Author: moggie
Created: 2011-12-16 22:19:44+00:00
State: open

Currently, the PHP is not checking the validity of the values passed to food class method "add_new_food", only that data is passed at all for the required fields. It should check the datum for each field to ensure that it's of the desired type.

The food class method "add_new_food" should allow the following:

* For the **food name** (data required):
* A-Z & a-z (for now.)
* *No whitespace or null characters*
* For **Do you chew it or do you drink it?** (i.e. mass type):
* Integers (either of integer 1 and integer 2 is acceptable)
* *No whitespace or null characters*
* For the **single-serving size** (data_required):
* Integers
* Decimal numbers
* *No whitespace or null characters*
* For the **total fat per serving** (data_required):
* Integers
* Decimal numbers
* *No whitespace or null characters*
* For **total saturated fat per serving**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)
* For **monounsaturated fats**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)
* For **polyunsaturated fats**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)
* For **transisomer fats**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)
* For **protein per serving**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)
* For **total carbohydrates per serving** (data_required):
* Integers
* Decimal numbers
* *No whitespace or null characters*
* For **dietary fiber**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)
* For **sugars**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)
* For **cholesterol per serving**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)
* For **sodium per serving**:
* Integers
* Decimal numbers
* NULL (Meaning the user did not submit anything for this field)