Track order insert date
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 28 May 2016 17:21:10 +0000 (18:21 +0100)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 28 May 2016 17:21:10 +0000 (18:21 +0100)
db.sql
lib/App/Web/Oof.pm

diff --git a/db.sql b/db.sql
index eaff6f267247e5ce77fdfbca403424ce3c0e5cf0..b75393541c351806d651a4e6237061881a6b89a1 100644 (file)
--- 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,
index c3aeeb1883c5b07012a273a876da0a926bead690..69fcac39eba64accbb7c87408512f258377df7a3 100644 (file)
@@ -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 => [
This page took 0.012813 seconds and 4 git commands to generate.