From c48e52f95ca454f9035b44d7eb726a4ebec4abc9 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 16 Jul 2021 10:20:32 -0400 Subject: [PATCH] add a floor date to prevent adjusting actual history based on the supplied timestamp --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index b8e775b..09f1745 100644 --- a/index.js +++ b/index.js @@ -691,5 +691,12 @@ function build_where(req, c, w, d, args) { args.push(req.body.scenario[i]); c = c + 1; }; + //if the request has a stamp, then it's an adjustment + //prevent making adjustment to actual history by limiting to current stamp and beyond + if (req.body.stamp) { + w = w + + ` + AND order_date >= '` + req.body.stamp + "'::date"; + } return { c, w, d }; -} +} \ No newline at end of file