diff options
author | Jochen Topf <jochen@topf.org> | 2011-10-13 10:24:30 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2011-10-13 10:24:30 +0200 |
commit | 13c3e0d2742b90eed09beb19e3622b795da9002b (patch) | |
tree | bae2df6729f7ed0266da8eef7ab40e62cc586729 /web/lib | |
parent | fc9dbd0508e37c0c7398c480d28a69f2a1c3e58a (diff) | |
download | taginfo-13c3e0d2742b90eed09beb19e3622b795da9002b.tar taginfo-13c3e0d2742b90eed09beb19e3622b795da9002b.tar.gz |
fix: distribution map did not work when there were no nodes with a tag
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 |