From 2435852c108ff04f48a09dcb013ece99e49d1eed Mon Sep 17 00:00:00 2001 From: Leon Fedotov Date: Fri, 6 Oct 2017 02:37:26 +0300 Subject: [PATCH] Sandbox migration (#467) * adding sandbox change migration * adding winston slack logger * v2.10.1 * remove wrong ticket ids * 2.10.2 * disable exit and only lookup current event id * 2.10.3 * Update 20171006005624_sandbox2017.js * Update 20171006005624_sandbox2017.js * update search --- package.json | 2 +- routes/gate_routes.js | 19 +++++++++++-------- views/pages/gate.jade | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 04063f0de..012421ea1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "this is part of the deployment proess, so it is important to update the version number", "version name corresponds to the github release name / tag name - https://github.com/Midburn/Spark/releases" ], - "version": "2.10.2", + "version": "2.10.3", "private": true, "scripts": { "postinstall": "bower install", diff --git a/routes/gate_routes.js b/routes/gate_routes.js index 53a4f5e3a..68aeb9399 100644 --- a/routes/gate_routes.js +++ b/routes/gate_routes.js @@ -11,7 +11,7 @@ var constants = require('../models/constants'); router.get('/', userRole.isGateManager(), function (req, res) { //TODO Temp SANDBOX2017, we need to add a global current-event selector. - Event.forge({event_id: 'SANDBOX2017'}).fetch().then(event => { + Event.forge({event_id: constants.CURRENT_EVENT_ID}).fetch().then(event => { return res.render('pages/gate', { gate_code: event.attributes.gate_code }); @@ -37,13 +37,16 @@ router.get('/ajax/tickets', [security.protectJwt, userRole.isGateManager()], asy .from('tickets') .leftJoin('users', 'tickets.holder_id', 'users.user_id') .leftJoin('users_groups', 'tickets.entrance_group_id', 'users_groups.group_id') - .where('ticket_number', isNaN(parseInt(req.query.search)) ? req.query.search : parseInt(req.query.search)) - .orWhere('first_name', 'LIKE', '%' + req.query.search + '%') - .orWhere('last_name', 'LIKE', '%' + req.query.search + '%') - .orWhere('email', 'LIKE', '%' + req.query.search + '%') - .orWhere('israeli_id', 'LIKE', '%' + req.query.search + '%') - .orWhereRaw("(first_name REGEXP '" + searchRegex + "' and last_name REGEXP '" + searchRegex + "')") - //.limit(parseInt(req.query.limit)).offset(parseInt(req.query.offset)) + .where('tickets.event_id', constants.CURRENT_EVENT_ID) + .andWhere(function() { + this.where('ticket_number', isNaN(parseInt(req.query.search)) ? req.query.search : parseInt(req.query.search)) + .orWhere('first_name', 'LIKE', '%' + req.query.search + '%') + .orWhere('last_name', 'LIKE', '%' + req.query.search + '%') + .orWhere('email', 'LIKE', '%' + req.query.search + '%') + .orWhere('israeli_id', 'LIKE', '%' + req.query.search + '%') + .orWhereRaw("(first_name REGEXP '" + searchRegex + "' and last_name REGEXP '" + searchRegex + "')") + //.limit(parseInt(req.query.limit)).offset(parseInt(req.query.offset)) + }) .then((tickets) => { res.status(200).json({rows: tickets, total: tickets.length}) }).catch((err) => { diff --git a/views/pages/gate.jade b/views/pages/gate.jade index 3e9c1b6c1..b52b5011b 100644 --- a/views/pages/gate.jade +++ b/views/pages/gate.jade @@ -103,7 +103,7 @@ block scripts return '#{t("gate:enter_ticket")} '; } else { - return '#{t("gate:exit_ticket")} '; } };