Adds settings for featured proposals

This commit is contained in:
decabeza
2018-11-29 19:11:58 +01:00
parent 609d2083f8
commit 37da986014
8 changed files with 35 additions and 9 deletions

View File

@@ -130,11 +130,13 @@ class ProposalsController < ApplicationController
def load_featured
return unless !@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank? && @current_order != "recommendations"
@featured_proposals = Proposal.not_archived.unsuccessful
.sort_by_confidence_score.limit(Setting['featured_proposals_number'])
if @featured_proposals.present?
set_featured_proposal_votes(@featured_proposals)
@resources = @resources.where('proposals.id NOT IN (?)', @featured_proposals.map(&:id))
if Setting['feature.featured_proposals']
@featured_proposals = Proposal.not_archived.unsuccessful
.sort_by_confidence_score.limit(Setting['featured_proposals_number'])
if @featured_proposals.present?
set_featured_proposal_votes(@featured_proposals)
@resources = @resources.where('proposals.id NOT IN (?)', @featured_proposals.map(&:id))
end
end
end