aboutsummaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-09-07 20:32:36 +0200
committerJochen Topf <jochen@topf.org>2014-09-07 20:32:36 +0200
commit0466edb82a7ad345308b518c06d30ce50f006011 (patch)
treea453dacba78eb9d2782036f5366836bd7025c183 /web/lib
parentdf100dfa580704603bfaad90faaf6c95eb6aeadd (diff)
downloadtaginfo-0466edb82a7ad345308b518c06d30ce50f006011.tar
taginfo-0466edb82a7ad345308b518c06d30ce50f006011.tar.gz
Only output tags used by projects with status OK.
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/api/v4/tag.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/web/lib/api/v4/tag.rb b/web/lib/api/v4/tag.rb
index b15cf8d..3fe55a4 100644
--- a/web/lib/api/v4/tag.rb
+++ b/web/lib/api/v4/tag.rb
@@ -278,12 +278,14 @@ class Taginfo < Sinatra::Base
value = params[:value]
q = like_contains(params[:query])
total = @db.select('SELECT count(*) FROM projects.projects p, projects.project_tags t ON p.id=t.project_id').
+ condition("status = 'OK'").
condition('key = ?', key).
condition_if('value = ? OR VALUE IS NULL', value).
condition_if("value LIKE ? ESCAPE '@' OR name LIKE ? ESCAPE '@'", q, q).
get_first_value().to_i
res = @db.select('SELECT t.project_id, p.name, p.icon_url AS project_icon_url, t.key, t.value, t.description, t.doc_url, t.icon_url, t.on_node, t.on_way, t.on_relation, t.on_area FROM projects.projects p, projects.project_tags t ON p.id=t.project_id').
+ condition("status = 'OK'").
condition('key = ?', key).
condition_if('value = ? OR VALUE IS NULL', value).
condition_if("value LIKE ? ESCAPE '@' OR name LIKE ? ESCAPE '@'", q, q).