update maxCompare
This commit is contained in:
parent
b56d26d5c1
commit
51b76e56f2
|
@ -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});
|
||||
|
|
Loading…
Reference in New Issue
Block a user