From: Marius Gavrilescu Date: Sat, 28 May 2016 17:21:10 +0000 (+0100) Subject: Track order insert date X-Git-Tag: 0.000_007~3 X-Git-Url: http://git.ieval.ro/?p=app-web-oof.git;a=commitdiff_plain;h=defe4693186b38cefe3e19be1725272bb07c8b5d Track order insert date --- diff --git a/db.sql b/db.sql index eaff6f2..b753935 100644 --- a/db.sql +++ b/db.sql @@ -18,6 +18,7 @@ CREATE TABLE IF NOT EXISTS discounts ( CREATE TABLE IF NOT EXISTS orders ( id TEXT PRIMARY KEY, + date BIGINT NOT NULL, products JSON NOT NULL, total INT NOT NULL, discount VARCHAR(20) REFERENCES discounts UNIQUE, diff --git a/lib/App/Web/Oof.pm b/lib/App/Web/Oof.pm index c3aeeb1..69fcac3 100644 --- a/lib/App/Web/Oof.pm +++ b/lib/App/Web/Oof.pm @@ -213,7 +213,7 @@ sub order_app { die "Not enough of " .$prod->{title}."\n" if $prod->{quantity} > $stock; $db{$$}->update(products => {stock => $stock - $prod->{quantity}}, {product => $prod->{product}}); } - $db{$$}->insert(orders => {id => $id, %parms}); + $db{$$}->insert(orders => {id => $id, date => time, %parms}); $db{$$}->commit; sendmail (Email::Simple->create( header => [