summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2013-04-27 15:13:26 +0200
committercos <cos>2013-04-27 15:13:26 +0200
commite67393e1f4262dd4f81b822042cfe2ae8252046c (patch)
tree21d845774688b9b81033428070fe9d22161ff0bb
parente6edcc8fbb18e9fcc70037af4c476ae1f76c604d (diff)
downloadmat-e67393e1f4262dd4f81b822042cfe2ae8252046c.zip
Print a warning when including an empty recipe in shoppinglist.
-rwxr-xr-xmat3
1 files changed, 3 insertions, 0 deletions
diff --git a/mat b/mat
index 77d79dd..6a1a72e 100755
--- a/mat
+++ b/mat
@@ -663,6 +663,9 @@ sub cmd_shoppinglist {
for my $recipe (@shop_recipes) {
# my $contents = $db->selectall_arrayref("SELECT * FROM contents WHERE recipe_id=".$recipe.";");
my $contents = $db->selectall_hashref("SELECT * FROM contents WHERE recipe_id=".$recipe.";", 'ingredient_id');
+ unless (%$contents) {
+ print "WARNING recipe $recipe contains no ingredients!\n";
+ }
for my $content ( keys(%$contents)) {
# print %$contents, "\n";
my $ingredientcol = $db->selectcol_arrayref("SELECT name FROM ingredients WHERE id=".$content.";");