diff options
author | cos <cos> | 2014-01-18 14:59:28 +0100 |
---|---|---|
committer | cos <cos> | 2014-01-18 14:59:28 +0100 |
commit | 9a9ccd11e0fe68232cc605f9bfdd883f4c0afe4f (patch) | |
tree | 24cea60d497fa07b656e232679aae4c9a73dbfb0 | |
parent | 3e7f9000c6868549b1b9cf8d447aa30bb54624f8 (diff) | |
download | mat-9a9ccd11e0fe68232cc605f9bfdd883f4c0afe4f.zip |
Store preparation dates in inventory table.
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | TODO | 4 | ||||
-rwxr-xr-x | mat | 5 |
3 files changed, 4 insertions, 7 deletions
@@ -10,7 +10,7 @@ CREATE TABLE ingredients (id INTEGER PRIMARY KEY AUTOINCREMENT, name, shop_posit CREATE TABLE contents (recipe_id INTEGER, ingredient_id INTEGER, quantity FLOAT, unit); CREATE TABLE plan (date DATETIME, mealtype, recipe_id INTEGER, state, comment_id); CREATE TABLE comments (id INTEGER PRIMARY KEY AUTOINCREMENT, comment); -CREATE TABLE inventory (id INTEGER PRIMARY KEY AUTOINCREMENT, recipe_id INTEGER, amount INTEGER, storage); +CREATE TABLE inventory (id INTEGER PRIMARY KEY AUTOINCREMENT, recipe_id INTEGER, preparation_date DATETIME, amount INTEGER, storage); All basic operations are performed using the perl script mat. It is possible to get a crude list of commands available by running: "mat help". @@ -1,5 +1,3 @@ - * Add a README file describing how to use this stuff. Include an sql schema. - * Replace currently cooking with a planned queue of meals. * Implement web thingy to view & relocate portions. @@ -7,8 +5,6 @@ * Combine into one row on the shoppinglist when there are several entries of the same ingredient. - * Store preparation dates in inventory table. - * Add command to feedback when portions were too small (still hungry/ate five chocolate bars after lunch) or too large (became full/lunch took two hours to complete). @@ -346,8 +346,9 @@ sub print_label { sub cmd_storeportion { my ( $recipe_id, $amount, $storage ) = @_; - my $sql = "INSERT INTO inventory (recipe_id, amount, storage ) VALUES (". - "$recipe_id, $amount, '$storage' );"; + my $sql = "INSERT INTO inventory (recipe_id, preparation_date, amount, ". + "storage ) VALUES ($recipe_id, ".`date +%Y%m%d|tr -d '\n'`.", $amount, ". + "'$storage' );"; $db->do($sql); my $inventory_id = $db->last_insert_id(undef, undef, undef, undef); |