From 0466edb82a7ad345308b518c06d30ce50f006011 Mon Sep 17 00:00:00 2001
From: Jochen Topf <jochen@topf.org>
Date: Sun, 7 Sep 2014 20:32:36 +0200
Subject: Only output tags used by projects with status OK.

---
 web/lib/api/v4/tag.rb | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'web/lib')

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).
-- 
cgit v1.2.3