diff --git a/app/helpers/budget_executions_helper.rb b/app/helpers/budget_executions_helper.rb index 1681da6f4..ec448c675 100644 --- a/app/helpers/budget_executions_helper.rb +++ b/app/helpers/budget_executions_helper.rb @@ -3,15 +3,13 @@ module BudgetExecutionsHelper def winner_investments(heading) if params[:status].present? heading.investments - .selected - .sort_by_ballots + .winners .joins(:milestones) .distinct .where('budget_investment_milestones.status_id = ?', params[:status]) else heading.investments - .selected - .sort_by_ballots + .winners .joins(:milestones) .distinct end diff --git a/spec/features/budgets/executions_spec.rb b/spec/features/budgets/executions_spec.rb index 6c3b6b6b1..03bdc21ab 100644 --- a/spec/features/budgets/executions_spec.rb +++ b/spec/features/budgets/executions_spec.rb @@ -6,10 +6,10 @@ feature 'Executions' do let(:group) { create(:budget_group, budget: budget) } let(:heading) { create(:budget_heading, group: group, price: 1000) } - let!(:investment1) { create(:budget_investment, :selected, heading: heading, price: 200, ballot_lines_count: 900) } - let!(:investment2) { create(:budget_investment, :selected, heading: heading, price: 300, ballot_lines_count: 800) } + let!(:investment1) { create(:budget_investment, :winner, heading: heading, price: 200, ballot_lines_count: 900) } + let!(:investment2) { create(:budget_investment, :winner, heading: heading, price: 300, ballot_lines_count: 800) } let!(:investment3) { create(:budget_investment, :incompatible, heading: heading, price: 500, ballot_lines_count: 700) } - let!(:investment4) { create(:budget_investment, :selected, heading: heading, price: 600, ballot_lines_count: 600) } + let!(:investment4) { create(:budget_investment, :winner, heading: heading, price: 600, ballot_lines_count: 600) } scenario 'only displays investments with milestones' do create(:budget_investment_milestone, investment: investment1)