Add logic to show only winner investments if budget is finished
Backported from AyuntamientoMadrid/consul
This commit is contained in:
@@ -32,7 +32,11 @@ module Budgets
|
||||
respond_to :html, :js
|
||||
|
||||
def index
|
||||
@investments = investments.page(params[:page]).per(10).for_render
|
||||
if @budget.finished?
|
||||
@investments = investments.winners.page(params[:page]).per(10).for_render
|
||||
else
|
||||
@investments = investments.page(params[:page]).per(10).for_render
|
||||
end
|
||||
|
||||
@investment_ids = @investments.pluck(:id)
|
||||
load_investment_votes(@investments)
|
||||
|
||||
@@ -146,6 +146,8 @@ class Budget < ActiveRecord::Base
|
||||
%w{random}
|
||||
when 'publishing_prices', 'balloting', 'reviewing_ballots'
|
||||
%w{random price}
|
||||
when 'finished'
|
||||
%w{random}
|
||||
else
|
||||
%w{random confidence_score}
|
||||
end
|
||||
@@ -193,5 +195,3 @@ class Budget < ActiveRecord::Base
|
||||
slug.nil? || drafting?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user