From 576b91f578702748ec19c297b3f7522b7889ddd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D7=A8=D7=95=D7=A2=D7=99=20=D7=A6=D7=97=D7=95=D7=A8?= Date: Sun, 21 May 2017 01:12:58 +0300 Subject: [PATCH] Fixing quota issue --- config/default.js | 4 +++- models/user.js | 3 ++- routes/api_gate_routes.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/default.js b/config/default.js index a1d2ee323..cab216893 100644 --- a/config/default.js +++ b/config/default.js @@ -18,7 +18,9 @@ else { switch (process.env.SPARK_DB_CLIENT || "mysql") { case "mysql": - console.log("Spark config: Using MySQL database", process.env.SPARK_DB_HOSTNAME || "localhost"); + console.log("Spark config: Using MySQL database", + process.env.SPARK_DB_HOSTNAME || "localhost", "/", + process.env.SPARK_DB_DBNAME || "spark"); exports.database = { "client": process.env.SPARK_DB_CLIENT || "mysql", "host": process.env.SPARK_DB_HOSTNAME || "localhost", diff --git a/models/user.js b/models/user.js index c4a99c491..d1e08cebe 100644 --- a/models/user.js +++ b/models/user.js @@ -242,7 +242,8 @@ var UsersGroup = bookshelf.Model.extend({ }); }, quotaReached: async function () { - return (await this.usersInsideEventsCounter >= this.attributes.entrance_quota); + let inside = await this.usersInsideEventsCounter; + return (inside >= this.attributes.entrance_quota); } } }); diff --git a/routes/api_gate_routes.js b/routes/api_gate_routes.js index 812d023a6..bb382373b 100644 --- a/routes/api_gate_routes.js +++ b/routes/api_gate_routes.js @@ -142,7 +142,7 @@ router.post('/gate-enter', async function (req, res) { return sendError(res, 500, "ALREADY_INSIDE"); } - if (req.body.force) { + if (req.body.force === "true") { log.warn('Forced ticket entrance', ticket.attributes.ticket_number); ticket.attributes.forced_entrance = true; ticket.attributes.forced_entrance_reason = req.body.force_reason;