From a6d60a0e104587364f8663424acdb147f14f5a67 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sat, 29 Apr 2017 11:31:17 +0200 Subject: [PATCH] fixes #179: ability to search for a given field with key:value syntax --- angular_app/js/filters.js | 8 +++++++- tools/qrcode_reader.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/angular_app/js/filters.js b/angular_app/js/filters.js index 5dc883b..3ea203b 100644 --- a/angular_app/js/filters.js +++ b/angular_app/js/filters.js @@ -39,7 +39,13 @@ eventManApp.filter('splittedFilter', ['$filter', return function(inputArray, searchText) { var wordArray = searchText ? searchText.toLowerCase().split(/\s+/) : []; for (var x=0; x < wordArray.length; x++) { - inputArray = $filter('filter')(inputArray, wordArray[x]); + var filter_item = wordArray[x]; + if (filter_item.indexOf(':') != -1) { + var filter_item_split = filter_item.split(':', 2); + filter_item = {}; + filter_item[filter_item_split[0]] = filter_item_split[1]; + } + inputArray = $filter('filter')(inputArray, filter_item); } return inputArray; }; diff --git a/tools/qrcode_reader.py b/tools/qrcode_reader.py index 3869604..798b1d1 100755 --- a/tools/qrcode_reader.py +++ b/tools/qrcode_reader.py @@ -123,7 +123,8 @@ class Connector(): pass if limit_field: code = code[:limit_field] - params = {cfg['event']['field']: code, '_errorMessage': 'code: %s' % code, '_searchFor': code} + _searchFor = '%s:%s' % (cfg['event']['field'], code) + params = {cfg['event']['field']: code, '_errorMessage': 'code: %s' % code, '_searchFor': _searchFor} checkin_url = self.checkin_url + '?' + urllib.parse.urlencode(params) json = convert(dict(self.cfg['actions'])) req = self.session.put(checkin_url, json=json, timeout=TIMEOUT)