From 8a229580fcda01c8c3e4c53b7cbab84c1e9e8c66 Mon Sep 17 00:00:00 2001 From: Radek Dostal Date: Wed, 16 Jan 2013 21:19:42 +0100 Subject: [PATCH] Improve picture distribution for Issue #14 Changing size of grouping rectangle, so exactly FIND_IN_AREA_LIMIT fits on the screen. Signed-off-by: Radek Dostal --- app/models/photo.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/photo.rb b/app/models/photo.rb index ce308e4..e8635ed 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -140,8 +140,8 @@ def self.find_in_area(bbox) return end bits.map! { |b| b.to_f } - lat_step = (bits[1] - bits[3]) / 400 - lon_step = (bits[0] - bits[2]) / 300 + lat_step = (bits[1] - bits[3]) / Math.sqrt(FIND_IN_AREA_LIMIT) + lon_step = (bits[0] - bits[2]) / Math.sqrt(FIND_IN_AREA_LIMIT) Photo.find( :all, :conditions => [ "lat IS NOT NULL AND lon IS NOT NULL AND lat >= ? AND lat <= ? AND lon >= ? AND lon <= ? AND status = 'available'",