Fixes all management bi issues except filtering by geozone

This commit is contained in:
kikito
2016-12-07 16:35:27 +01:00
parent 2760e751e7
commit b3be1633af
11 changed files with 59 additions and 26 deletions

View File

@@ -6,8 +6,8 @@ class Management::Budgets::InvestmentsController < Management::BaseController
before_action :only_verified_users, except: :print
def index
@investments = apply_filters_and_search(@investments).order(cached_votes_up: :desc).page(params[:page]).for_render
@investment_ids = @investments.pluck(:id)
@investments = apply_filters_and_search(@investments).page(params[:page])
set_investment_votes(@investments)
end
def new
@@ -26,10 +26,12 @@ class Management::Budgets::InvestmentsController < Management::BaseController
end
def show
set_investment_votes(@investment)
end
def vote
@investment.register_vote(managed_user, 'yes')
@investment.register_selection(managed_user)
set_investment_votes(@investment)
end
def print
@@ -39,6 +41,10 @@ class Management::Budgets::InvestmentsController < Management::BaseController
private
def set_investment_votes(investments)
@investment_votes = managed_user ? managed_user.budget_investment_votes(investments) : {}
end
def load_budget
@budget = Budget.find(params[:budget_id])
end