From 6c4cacbd3e448c85ead6a77cf78c6441b6993287 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Tue, 21 Oct 2014 14:49:10 -0700 Subject: [PATCH] slight adjustment to suggestions --- models/site.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/site.rb b/models/site.rb index 46ffc148..c97de7df 100644 --- a/models/site.rb +++ b/models/site.rb @@ -91,7 +91,7 @@ class Site < Sequel::Model } } - SUGGESTIONS_LIMIT = 32 + SUGGESTIONS_LIMIT = 30 SUGGESTIONS_VIEWS_MIN = 500 CHILD_SITES_MAX = 100 @@ -902,7 +902,7 @@ class Site < Sequel::Model suggestions_dataset = Site.exclude(id: id).order(:views.desc, :updated_at.desc) suggestions = suggestions_dataset.where(tags: tags).limit(limit, offset).all - return suggestions if suggestions.length == 32 + return suggestions if suggestions.length == limit suggestions += suggestions_dataset.where("views >= #{SUGGESTIONS_VIEWS_MIN}").limit(limit-suggestions.length).order(Sequel.lit('RANDOM()')).all end