]> git.openstreetmap.org Git - rails.git/commitdiff
Use num_changes to detect empty changesets instead of the bbox
authorTom Hughes <tom@compton.nu>
Tue, 12 Jul 2011 14:55:17 +0000 (15:55 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 12 Jul 2011 14:55:17 +0000 (15:55 +0100)
app/controllers/changeset_controller.rb
app/views/changeset/_map.html.erb
test/functional/changeset_controller_test.rb

index 0aeaf200d12393d8cba4e7cbca0e001f2d7e43ad..45b5f80f9479c7fe8c300d363f77215083e344d8 100644 (file)
@@ -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
index 39906af0833925c8098555e331f972bb9b77d80f..69d32b2c2357439c9058576e1d16e6ec418d1724 100644 (file)
@@ -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) {
index bb6d2f52a0f21f78c33b098ae0f95e7656b40856..0d062ab2d801cf6477fdc3f84ca279b131606c00 100644 (file)
@@ -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