diff --git a/app/index.rb b/app/index.rb index f6187f9b..9648295a 100644 --- a/app/index.rb +++ b/app/index.rb @@ -1,8 +1,4 @@ get '/?' do - if params[:_ga_adgroupid] - session[:ga_adgroupid] = params[:_ga_adgroupid] - end - if current_site require_login @@ -32,7 +28,6 @@ get '/?' do halt erb :'home', locals: {site: current_site} end - if SimpleCache.expired?(:index) @sites_count = Site.count.roundup(100) @total_hits_count = DB['SELECT SUM(hits) AS hits FROM SITES'].first[:hits] || 0 @@ -52,7 +47,7 @@ get '/?' do @create_disabled = false - @index_rendered = SimpleCache.store :index, erb(:index, layout: :index_layout), 1.hour + @index_rendered = SimpleCache.store :index, erb(:index, layout: :index_layout), (ENV['RACK_ENV'] == 'test' ? -1 : 1.hour) return @index_rendered else diff --git a/models/site.rb b/models/site.rb index 2225a99a..2779fec3 100644 --- a/models/site.rb +++ b/models/site.rb @@ -111,7 +111,7 @@ class Site < Sequel::Model COMMENTING_ALLOWED_UPDATED_COUNT = 2 SUGGESTIONS_LIMIT = 30 - SUGGESTIONS_VIEWS_MIN = 500 + SUGGESTIONS_VIEWS_MIN = 10000 CHILD_SITES_MAX = 30 IP_CREATE_LIMIT = 1000 diff --git a/tests/site_tests.rb b/tests/site_tests.rb index 21b1e36a..939453a1 100644 --- a/tests/site_tests.rb +++ b/tests/site_tests.rb @@ -112,7 +112,7 @@ describe Site do describe 'suggestions' do it 'should return suggestions for tags' do site = Fabricate :site, new_tags_string: 'vegetables' - Site::SUGGESTIONS_LIMIT.times { Fabricate :site, new_tags_string: 'vegetables' } + Site::SUGGESTIONS_LIMIT.times { Fabricate :site, new_tags_string: 'vegetables', site_changed: true } _(site.suggestions.length).must_equal Site::SUGGESTIONS_LIMIT @@ -122,10 +122,10 @@ describe Site do site = Fabricate :site, new_tags_string: 'gardening' (Site::SUGGESTIONS_LIMIT-5).times { - Fabricate :site, new_tags_string: 'gardening', views: Site::SUGGESTIONS_VIEWS_MIN + Fabricate :site, new_tags_string: 'gardening', views: Site::SUGGESTIONS_VIEWS_MIN, site_changed: true } - _(site.suggestions.length).must_equal(Site::SUGGESTIONS_LIMIT - 5) + _(site.suggestions.length).must_equal(Site::SUGGESTIONS_LIMIT) end end