diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index df232069b..e04b275d1 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -64,7 +64,7 @@ module CommentableActions end def tag_cloud - resource_model.tag_counts.order("#{resource_name.pluralize}_count": :desc, name: :asc).limit(20) + resource_model.last_week.tag_counts.order("#{resource_name.pluralize}_count": :desc, name: :asc).limit(5) end def load_featured_tags diff --git a/app/models/debate.rb b/app/models/debate.rb index 086bd5ae4..7b264d036 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -34,7 +34,7 @@ class Debate < ActiveRecord::Base scope :sort_by_random, -> { reorder("RANDOM()") } scope :sort_by_relevance, -> { all } scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) } - + scope :last_week, -> { where("created_at >= ?", 7.days.ago)} # Ahoy setup visitable # Ahoy will automatically assign visit_id on create diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 22fb55cbd..86d063a36 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -40,7 +40,8 @@ class Proposal < ActiveRecord::Base scope :sort_by_random, -> { reorder("RANDOM()") } scope :sort_by_relevance , -> { all } scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) } - + scope :last_week, -> { where("created_at >= ?", 7.days.ago)} + pg_search_scope :pg_search, { against: { title: 'A',