diff options
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/api/db.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/web/lib/api/db.rb b/web/lib/api/db.rb index 1245a4e..82cf48c 100644 --- a/web/lib/api/db.rb +++ b/web/lib/api/db.rb @@ -201,8 +201,12 @@ class Taginfo < Sinatra::Base }) do key = params[:key] content_type :png - @db.select('SELECT nodes FROM db.key_distributions'). + @db.select('SELECT png FROM db.key_distributions'). + condition("object_type='n'"). condition('key = ?', key). + get_first_value() || + @db.select('SELECT png FROM db.key_distributions'). + condition('key IS NULL'). get_first_value() end @@ -215,8 +219,12 @@ class Taginfo < Sinatra::Base }) do key = params[:key] content_type :png - @db.select('SELECT nodes FROM db.key_distributions'). + @db.select('SELECT png FROM db.key_distributions'). + condition("object_type='n'"). condition('key = ?', key). + get_first_value() || + @db.select('SELECT png FROM db.key_distributions'). + condition('key IS NULL'). get_first_value() end @@ -229,8 +237,12 @@ class Taginfo < Sinatra::Base }) do key = params[:key] content_type :png - @db.select('SELECT ways FROM db.key_distributions'). + @db.select('SELECT png FROM db.key_distributions'). + condition("object_type='w'"). condition('key = ?', key). + get_first_value() || + @db.select('SELECT png FROM db.key_distributions'). + condition('key IS NULL'). get_first_value() end |