summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2012-05-12 15:59:42 +0200
committercos <cos>2012-12-17 21:12:06 +0100
commit19180c698d7a008c298424177706305319df94b8 (patch)
treed7a87b276dbcfc71e09d057c9a1406af1823c74e
parent35a096df3dde0dacdcb83a8b3972776e7c7d76fb (diff)
downloadmat-19180c698d7a008c298424177706305319df94b8.zip
Have shoppinglist check state of entries.
Only add ingredients to shoppinglist for planned meals that are not ready, frozen or already shopped for.
-rwxr-xr-xmat5
1 files changed, 4 insertions, 1 deletions
diff --git a/mat b/mat
index dcf9ca1..6de3bd7 100755
--- a/mat
+++ b/mat
@@ -409,7 +409,10 @@ sub cmd_shoppinglist {
# }
my $entries = $db->selectall_arrayref("SELECT recipe_id FROM plan WHERE date ".
- "BETWEEN '".$startdate."' and '".$enddate."'", { Slice => {} });
+ "BETWEEN '".$startdate."' and '".$enddate."' and ".
+ "IFNULL(state, 'null') != 'frozen' and ".
+ "IFNULL(state, 'null') != 'ready' and ".
+ "IFNULL(state, 'null') != 'sourced'", { Slice => {} });
my %recipe_count;
for my $entry ( @$entries ) {
$recipe_count{$entry->{recipe_id}}++;