From 749c58f37777a94d5048f31b4a96ca7cd60af746 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Thu, 7 May 2015 13:21:53 +0000 Subject: [PATCH] VRFS-3036 refactoring band search --- ruby/lib/jam_ruby/models/base_search.rb | 9 +++++++++ ruby/lib/jam_ruby/models/musician_search.rb | 9 --------- web/app/helpers/client_helper.rb | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ruby/lib/jam_ruby/models/base_search.rb b/ruby/lib/jam_ruby/models/base_search.rb index 84b5c9833..d6244b355 100644 --- a/ruby/lib/jam_ruby/models/base_search.rb +++ b/ruby/lib/jam_ruby/models/base_search.rb @@ -64,6 +64,15 @@ module JamRuby sort_order: { keys: SORT_VALS, map: SORT_ORDERS }, } + RESULT_FOLLOW = :follows + RESULT_FRIEND = :friends + + COUNT_FRIEND = :count_friend + COUNT_FOLLOW = :count_follow + COUNT_RECORD = :count_record + COUNT_SESSION = :count_session + COUNTERS = [COUNT_FRIEND, COUNT_FOLLOW, COUNT_RECORD, COUNT_SESSION] + def self.user_search_filter(user) unless ss = user.send(self.name.demodulize.tableize.singularize) ss = self.create_search(user) diff --git a/ruby/lib/jam_ruby/models/musician_search.rb b/ruby/lib/jam_ruby/models/musician_search.rb index 8482ee623..d796439d6 100644 --- a/ruby/lib/jam_ruby/models/musician_search.rb +++ b/ruby/lib/jam_ruby/models/musician_search.rb @@ -148,15 +148,6 @@ module JamRuby rel.includes([:instruments, :followings, :friends]) end - RESULT_FOLLOW = :follows - RESULT_FRIEND = :friends - - COUNT_FRIEND = :count_friend - COUNT_FOLLOW = :count_follow - COUNT_RECORD = :count_record - COUNT_SESSION = :count_session - COUNTERS = [COUNT_FRIEND, COUNT_FOLLOW, COUNT_RECORD, COUNT_SESSION] - def process_results_page(_results) @results = _results @user_counters = {} and return self unless user diff --git a/web/app/helpers/client_helper.rb b/web/app/helpers/client_helper.rb index c39e42878..c520cff52 100644 --- a/web/app/helpers/client_helper.rb +++ b/web/app/helpers/client_helper.rb @@ -49,6 +49,7 @@ module ClientHelper gon.ftue_network_test_max_clients = Rails.application.config.ftue_network_test_max_clients gon.ftue_maximum_gear_latency = Rails.application.config.ftue_maximum_gear_latency gon.musician_search_meta = MusicianSearch::SEARCH_FILTER_META + gon.band_search_meta = BandSearch::SEARCH_FILTER_META # is this the native client or browser? @nativeClient = is_native_client?