summaryrefslogtreecommitdiff
path: root/food_quantity.php
diff options
context:
space:
mode:
Diffstat (limited to 'food_quantity.php')
-rw-r--r--food_quantity.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/food_quantity.php b/food_quantity.php
index 3d8a2a4..b938745 100644
--- a/food_quantity.php
+++ b/food_quantity.php
@@ -29,6 +29,7 @@ $sql = sprintf ("
FROM foodDescs LEFT JOIN weights
ON foodDescs.ndb_no = weights.ndb_no
WHERE foodDescs.ndb_no = '%s'
+ AND weights.usda_status = 'active'
",
$db->_dbConn->Concat("foodDescs.long_desc", "', '", "foodDescs.comname"),
$food
@@ -53,9 +54,8 @@ incrementPopularityCounter($food, "foodDescs");
# some data housekeeping
for ( $idx = 0; $idx < count($db->_rows); $idx++ ) {
# the data from the USDA frequently has low order, unnecessary zeros to the
- # right of the decimal. here we strip off any superfluous zeros and/or
- # decimal points
- $db->_rows[$idx]['amount'] = trim($db->_rows[$idx]['amount'], ".0");
+ # right of the decimal. multipying by 1 is just an easy way to remove them.
+ $db->_rows[$idx]['amount'] = $db->_rows[$idx]['amount'] * 1;
# trim any extra commas from the end of foodDesc, as may appear
# due to the concatenation of long_desc and comname with a comma