consider empty string as missing when creating food item

This commit is contained in:
Bart Akeley 2018-12-15 12:27:23 -06:00
parent 5086906693
commit 90c6114166

View file

@ -60,12 +60,15 @@
(insert-quantity {:foodItemId foodItemId :quantity quantity})
:value-fn parse-special-types)))
(defn key-found?
[obj key]
(not (str/blank? (str (get obj key)))))
(defn get-missing-keys
"returns a list of required keys which were not found on the given food item"
[foodItem]
(remove
#(get foodItem %)
#(key-found? foodItem %)
[:name :placeId :latitude :longitude :category :quantity]))