summaryrefslogtreecommitdiff
path: root/web
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
parent95eabe7a9f66c49c164115502e4073adb08cd864 (diff)
downloadtaginfo-ee83b7feeca5e0bf0d2e29275ee73919f28bdb60.tar
taginfo-ee83b7feeca5e0bf0d2e29275ee73919f28bdb60.tar.gz
Fixed some more relation type unconsistencies
Diffstat (limited to 'web')
-rw-r--r--web/lib/api/v4/relation.rb6
-rw-r--r--web/lib/api/v4/relations.rb10
-rw-r--r--web/viewsjs/relations.js.erb8
3 files changed, 12 insertions, 12 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
diff --git a/web/viewsjs/relations.js.erb b/web/viewsjs/relations.js.erb
index 02eaf0f..a9389d6 100644
--- a/web/viewsjs/relations.js.erb
+++ b/web/viewsjs/relations.js.erb
@@ -6,22 +6,22 @@ function page_init() {
create_flexigrid('grid-relations', {
url: '/api/4/relations/all',
colModel: [
- { display: '<%= osm.relation_type %>', name: 'relation_type', width: 220, sortable: true },
+ { display: '<%= osm.relation_type %>', name: 'rtype', width: 220, sortable: true },
{ display: '<span title="<%= page.relations_of_type_tooltip %>"><%= osm.relations %></span>', name: 'count', width: 250, sortable: true, align: 'center' },
{ display: '<%= osm.tag %>', name: 'tag', width: 250, sortable: false },
{ display: '<span title="<%= page.prevalent_roles_tooltip %>"><%= page.prevalent_roles %></span>', name: 'prevalent_roles', width: 550, sortable: false }
],
searchitems: [
- { display: '<%= osm.relation_type %>', name: 'relation_type' }
+ { display: '<%= osm.relation_type %>', name: 'rtype' }
],
sortname: 'count',
sortorder: 'desc',
preProcess: function(data) {
data.rows = jQuery.map(data.data, function(row, i) {
return { 'cell': [
- link_to_rtype(row.relation_type),
+ link_to_rtype(row.rtype),
fmt_value_with_percent(row.count, row.count_fraction),
- link_to_tag('type', row.relation_type),
+ link_to_tag('type', row.rtype),
fmt_prevalent_role_list(row.prevalent_roles)
] };
});