From 9ea3d902272e13b18ac867e72da176fb9cd612d9 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Thu, 15 Sep 2011 21:18:06 -0700 Subject: [PATCH] Set default limit to 40 --- app/controllers/things_controller.rb | 2 +- app/models/thing.rb | 2 +- app/views/main/index.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/things_controller.rb b/app/controllers/things_controller.rb index 54b8dc9..8528db7 100644 --- a/app/controllers/things_controller.rb +++ b/app/controllers/things_controller.rb @@ -2,7 +2,7 @@ class ThingsController < ApplicationController respond_to :json def show - @things = Thing.find_closest(params[:lat], params[:lng], params[:limit] || 20) + @things = Thing.find_closest(params[:lat], params[:lng], params[:limit] || 40) unless @things.blank? respond_with @things else diff --git a/app/models/thing.rb b/app/models/thing.rb index b4f92e9..d6f4fd2 100644 --- a/app/models/thing.rb +++ b/app/models/thing.rb @@ -4,7 +4,7 @@ class Thing < ActiveRecord::Base belongs_to :user has_many :reminders - def self.find_closest(lat, lng, limit=20) + def self.find_closest(lat, lng, limit=40) query = <<-SQL SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(radians(lng) - RADIANS(?)) + SIN(RADIANS(?)) * SIN(RADIANS(lat)))) AS distance FROM things diff --git a/app/views/main/index.html.haml b/app/views/main/index.html.haml index 91159c9..a423018 100644 --- a/app/views/main/index.html.haml +++ b/app/views/main/index.html.haml @@ -8,7 +8,7 @@ = select_tag "city_state", "".html_safe, :tabindex => 10 = label_tag "address", t("labels.address"), :id => "address_label" = text_field_tag "address", params[:address], :tabindex => 11 - = hidden_field_tag "limit", params[:limit] || 20 + = hidden_field_tag "limit", params[:limit] || 40 = submit_tag t("buttons.find", :thing => t("defaults.thing").pluralize), :tabindex => 12 #logos = image_tag "logos/cfa.png", :alt => t("sponsors.cfa"), :title => t("sponsors.cfa")