diff --git a/Gemfile.lock b/Gemfile.lock index d89e5183..e46dfc6b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,8 +41,6 @@ GEM rails (~> 3.1) builder (3.0.4) cancan (1.6.10) - celluloid (0.15.2) - timers (~> 1.1.0) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.4) @@ -54,7 +52,6 @@ GEM coffee-script-source execjs coffee-script-source (1.8.0) - connection_pool (2.0.0) devise (3.4.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -100,13 +97,10 @@ GEM mime-types pg (0.17.1) pg (0.17.1-x86-mingw32) - phantomjs (1.9.7.1) polyglot (0.3.5) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-protection (1.5.3) - rack rack-ssl (1.3.4) rack rack-test (0.6.2) @@ -132,8 +126,6 @@ GEM rdoc (3.12.2) json (~> 1.4) redis (3.1.0) - redis-namespace (1.5.1) - redis (~> 3.0, >= 3.0.4) responders (1.1.1) railties (>= 3.2, < 4.2) sass (3.4.5) @@ -141,29 +133,14 @@ GEM railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - sidekiq (3.2.5) - celluloid (= 0.15.2) - connection_pool (>= 2.0.0) - json - redis (>= 3.0.6) - redis-namespace (>= 1.3.1) - sinatra (1.4.5) - rack (~> 1.4) - rack-protection (~> 1.4) - tilt (~> 1.3, >= 1.3.4) - slim (2.0.3) - temple (~> 0.6.6) - tilt (>= 1.3.3, < 2.1) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - temple (0.6.8) thor (0.19.1) thread_safe (0.3.4) tilt (1.4.1) - timers (1.1.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) @@ -196,13 +173,9 @@ DEPENDENCIES kaminari paperclip pg - phantomjs rails (= 3.2.17) rails3-jquery-autocomplete redis sass-rails - sidekiq - sinatra - slim uglifier (>= 1.0.3) uservoice-ruby diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 873c3835..177c7f13 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -194,8 +194,23 @@ class MainController < ApplicationController topic2id = params[:topic2id] if term && !term.empty? - @synapses = Synapse.select('DISTINCT "desc"'). - where('LOWER("desc") like ?', '%' + term.downcase + '%').limit(5).order('"desc"') + @synapses = Synapse.select('DISTINCT "desc"').where('LOWER("desc") like ?', '%' + term.downcase + '%').order('"desc"') + + # remove any duplicate synapse types that just differ by + # leading or trailing whitespaces + collectedDesc = [] + @synapses.delete_if {|s| + desc = s.desc == nil || s.desc == "" ? "" : s.desc.strip + if collectedDesc.index(desc) == nil + collectedDesc.push(desc) + boolean = false + else + boolean = true + end + } + + #limit to 5 results + @synapses = @synapses.slice(0,5) render json: autocomplete_synapse_generic_json(@synapses) diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb deleted file mode 100644 index 6a2d1b9c..00000000 --- a/config/initializers/sidekiq.rb +++ /dev/null @@ -1,9 +0,0 @@ -redis_url = Rails.env.development? ? 'redis://localhost:6379/0' : ENV['REDISTOGO_URL'] - -Sidekiq.configure_server do |config| - config.redis = { :url => redis_url, :namespace => 'metamaps' } -end - -Sidekiq.configure_client do |config| - config.redis = { :url => redis_url, :namespace => 'metamaps' } -end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f5ad183f..33532701 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,6 @@ -require 'sidekiq/web' - Metamaps::Application.routes.draw do root to: 'main#home', via: :get - - #To debug sidekiq and monitor processes, enable this route - #mount Sidekiq::Web, at: '/sidekiq' match 'request', to: 'main#requestinvite', via: :get, as: :request