From e5c80c80ade40c3360f49eb70a9db8464ffa9169 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 12 Jul 2011 15:55:17 +0100 Subject: [PATCH] Use num_changes to detect empty changesets instead of the bbox --- app/controllers/changeset_controller.rb | 2 +- app/views/changeset/_map.html.erb | 2 ++ test/functional/changeset_controller_test.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index 0aeaf200d..45b5f80f9 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -446,7 +446,7 @@ private # eliminate empty changesets (where the bbox has not been set) # this should be applied to all changeset list displays def conditions_nonempty() - return ['min_lat IS NOT NULL'] + return ['num_changes > 0'] end end diff --git a/app/views/changeset/_map.html.erb b/app/views/changeset/_map.html.erb index 39906af08..69d32b2c2 100644 --- a/app/views/changeset/_map.html.erb +++ b/app/views/changeset/_map.html.erb @@ -50,6 +50,7 @@ var bounds = new OpenLayers.Bounds(); <% @edits.each do |edit| %> + <% if edit.has_valid_bbox? %> var minlon = <%= edit.min_lon / GeoRecord::SCALE.to_f %>; var minlat = <%= edit.min_lat / GeoRecord::SCALE.to_f %>; var maxlon = <%= edit.max_lon / GeoRecord::SCALE.to_f %>; @@ -60,6 +61,7 @@ addBoxToMap(bbox, "<%= edit.id %>", true); <% end %> + <% end %> vectors.events.on({ "featureselected": function(feature) { diff --git a/test/functional/changeset_controller_test.rb b/test/functional/changeset_controller_test.rb index bb6d2f52a..0d062ab2d 100644 --- a/test/functional/changeset_controller_test.rb +++ b/test/functional/changeset_controller_test.rb @@ -1643,7 +1643,7 @@ EOF ## # This should display the last 20 changesets closed. def test_list - changesets = Changeset.find(:all, :order => "created_at DESC", :conditions => ['min_lat IS NOT NULL'], :limit=> 20) + changesets = Changeset.find(:all, :order => "created_at DESC", :conditions => ['num_changes > 0'], :limit=> 20) assert changesets.size <= 20 get :list, {:format => "html"} assert_response :success -- 2.43.2