From 282a45d9eee9f9d84216b1cf70a2fa75b9f8bbac Mon Sep 17 00:00:00 2001 From: JayWll Date: Wed, 6 May 2020 08:22:17 -0600 Subject: [PATCH] Bug fix. Alert date was not being correctly read by afterCreate function --- nodeapp/src/db.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodeapp/src/db.js b/nodeapp/src/db.js index 595b8f1..6a83c10 100644 --- a/nodeapp/src/db.js +++ b/nodeapp/src/db.js @@ -25,7 +25,7 @@ const Readings = sequelize.define('readings', { const lowtrigger = parseInt(result.find(o => o.dataValues.key === 'low-trigger').dataValues.value) const hightrigger = parseInt(result.find(o => o.dataValues.key === 'high-trigger').dataValues.value) const low = result.find(o => o.dataValues.key === 'low').dataValues.value - const alert = result.find(o => o.dataValues.key === 'low-trigger').dataValues.value + const alert = result.find(o => o.dataValues.key === 'alert').dataValues.value // Reset low moisture flag if it's set, and the reading is greater than high-trigger