Use num_changes to detect empty changesets instead of the bbox

This commit is contained in:
Tom Hughes 2011-07-12 15:55:17 +01:00
parent ea207f51cc
commit e5c80c80ad
3 changed files with 4 additions and 2 deletions

View 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

View 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) {

View 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