aboutsummaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-01-18 18:20:31 +0100
committerJochen Topf <jochen@topf.org>2013-01-18 18:20:31 +0100
commitee83b7feeca5e0bf0d2e29275ee73919f28bdb60 (patch)
tree728183cc6d2bd825ba669b0875a7378b21fcff6a /web/lib
parent95eabe7a9f66c49c164115502e4073adb08cd864 (diff)
downloadtaginfo-ee83b7feeca5e0bf0d2e29275ee73919f28bdb60.tar
taginfo-ee83b7feeca5e0bf0d2e29275ee73919f28bdb60.tar.gz
Fixed some more relation type unconsistencies
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/api/v4/relation.rb6
-rw-r--r--web/lib/api/v4/relations.rb10
2 files changed, 8 insertions, 8 deletions
diff --git a/web/lib/api/v4/relation.rb b/web/lib/api/v4/relation.rb
index 73c5a15..791dfd0 100644
--- a/web/lib/api/v4/relation.rb
+++ b/web/lib/api/v4/relation.rb
@@ -11,7 +11,7 @@ class Taginfo < Sinatra::Base
:paging => :optional,
:sort => %w( role count_all_members count_node_members count_way_members count_relation_members ),
:result => paging_results([
- [:relation_type, :STRING, 'Relation type'],
+ [:rtype, :STRING, 'Relation type'],
[:role, :STRING, 'Relation member role.'],
[:count_all_members, :INT, 'Number of members with this role.'],
[:count_all_members_fraction, :FLOAT, 'Number of members with this role devided by all members.'],
@@ -23,7 +23,7 @@ class Taginfo < Sinatra::Base
[:count_relation_members_fraction, :FLOAT, 'Number of members of type relation with this role devided by all members of type relation.']
]),
:example => { :rtype => 'multipolygon', :page => 1, :rp => 10 },
- :ui => '/reports/relation_types#roles'
+ :ui => '/relations/multipolygon#roles'
}) do
rtype = params[:rtype]
@@ -54,7 +54,7 @@ class Taginfo < Sinatra::Base
:rp => @ap.results_per_page,
:total => total,
:data => res.map{ |row| {
- :relation_type => row['rtype'],
+ :rtype => row['rtype'],
:role => row['role'],
:count_all_members => row['count_all'].to_i,
:count_all_members_fraction => (row['count_all'].to_f / relation_type_info['members_all'].to_i).round_to(4),
diff --git a/web/lib/api/v4/relations.rb b/web/lib/api/v4/relations.rb
index c84758d..9389f84 100644
--- a/web/lib/api/v4/relations.rb
+++ b/web/lib/api/v4/relations.rb
@@ -8,9 +8,9 @@ class Taginfo < Sinatra::Base
:query => 'Only show results where the relation type matches this query (substring match, optional).'
},
:paging => :optional,
- :sort => %w( relation_type count ),
+ :sort => %w( rtype count ),
:result => paging_results([
- [:relation_type, :STRING, 'Relation type'],
+ [:rtype, :STRING, 'Relation type'],
[:count, :INT, 'Number of relations with this type.'],
[:count_fraction, :INT, 'Number of relations with this type divided by the overall number of relations.'],
[:prevalent_roles, :ARRAY, 'Prevalent member roles.', [
@@ -21,7 +21,7 @@ class Taginfo < Sinatra::Base
]),
:notes => "prevalent_roles can be null if taginfo doesn't have role information for this relation type, or an empty array when there are no roles with more than 1% of members",
:example => { :page => 1, :rp => 10 },
- :ui => '/reports/relation_types#types'
+ :ui => '/relations'
}) do
total = @db.count('relation_types').
condition_if("rtype LIKE '%' || ? || '%'", params[:query]).
@@ -30,7 +30,7 @@ class Taginfo < Sinatra::Base
res = @db.select('SELECT * FROM relation_types').
condition_if("rtype LIKE '%' || ? || '%'", params[:query]).
order_by(@ap.sortname, @ap.sortorder) { |o|
- o.relation_type :rtype
+ o.rtype
o.count
}.
paging(@ap).
@@ -61,7 +61,7 @@ class Taginfo < Sinatra::Base
:rp => @ap.results_per_page,
:total => total,
:data => res.map{ |row| {
- :relation_type => row['rtype'],
+ :rtype => row['rtype'],
:count => row['count'].to_i,
:count_fraction => row['count'].to_f / all_relations,
:prevalent_roles => row['members_all'] ? pr[row['rtype']][0,10] : nil