Add logic to show only winner investments if budget is finished

Backported from AyuntamientoMadrid/consul
This commit is contained in:
María Checa
2018-07-17 12:53:07 +02:00
committed by Marko Lovic
parent ff9888d6fe
commit 8c69871cfa
3 changed files with 35 additions and 3 deletions

View File

@@ -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)