From 51b76e56f296b7a6b8223a543623c77f4f7eeca2 Mon Sep 17 00:00:00 2001 From: dongpd Date: Thu, 6 Feb 2020 09:45:50 +0700 Subject: [PATCH] update maxCompare --- api/controllers/ApiController.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/controllers/ApiController.js b/api/controllers/ApiController.js index 82357cd..0e79068 100644 --- a/api/controllers/ApiController.js +++ b/api/controllers/ApiController.js @@ -61,6 +61,7 @@ const db = makeDb(config); var currentIn = []; var currentOut = []; +var maxCompare = 5; exports.SaveLogs = async function (req, res) { @@ -125,13 +126,13 @@ exports.SaveLogs = async function (req, res) { } if (canSaveLogs) { if (req.body.type === "in") { - if (currentIn.length >= 10) { + if (currentIn.length >= maxCompare) { currentIn.shift(); } currentIn.push({"plate": req.body.plate, "time": currentTimestamp}); } if (req.body.type === "out") { - if (currentOut.length >= 10) { + if (currentOut.length >= maxCompare) { currentOut.shift(); } currentOut.push({"plate": req.body.plate, "time": currentTimestamp});