From 91d91f2ebf3ee666d1fcb744bcb1073270642231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 13 Nov 2018 12:53:02 +0100 Subject: [PATCH] Remove city heading specific code This code accidentally made it to consul, and it's specific to Madrid. --- app/controllers/budgets/executions_controller.rb | 14 +++----------- spec/features/budgets/executions_spec.rb | 13 ------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/app/controllers/budgets/executions_controller.rb b/app/controllers/budgets/executions_controller.rb index cf5b0c8f8..9af8893b4 100644 --- a/app/controllers/budgets/executions_controller.rb +++ b/app/controllers/budgets/executions_controller.rb @@ -7,7 +7,7 @@ module Budgets def show authorize! :read_executions, @budget @statuses = Milestone::Status.all - @investments_by_heading = investments_by_heading_ordered_alphabetically_with_city_heading_first.to_h + @investments_by_heading = investments_by_heading_ordered_alphabetically.to_h end private @@ -31,16 +31,8 @@ module Budgets @budget = Budget.find_by(slug: params[:id]) || Budget.find_by(id: params[:id]) end - def investments_by_heading_ordered_alphabetically_with_city_heading_first - investments_by_heading.sort do |a, b| - if a[0].name == 'Toda la ciudad' - -1 - elsif b[0].name == 'Toda la ciudad' - 1 - else - a[0].name <=> b[0].name - end - end + def investments_by_heading_ordered_alphabetically + investments_by_heading.sort { |a, b| a[0].name <=> b[0].name } end end end diff --git a/spec/features/budgets/executions_spec.rb b/spec/features/budgets/executions_spec.rb index 226d01cfe..53d0ef6b6 100644 --- a/spec/features/budgets/executions_spec.rb +++ b/spec/features/budgets/executions_spec.rb @@ -230,19 +230,6 @@ feature 'Executions' do heading end - scenario 'City heading is displayed first' do - heading.destroy! - other_heading1 = create_heading_with_investment_with_milestone(group: group, name: 'Other 1') - city_heading = create_heading_with_investment_with_milestone(group: group, name: 'Toda la ciudad') - other_heading2 = create_heading_with_investment_with_milestone(group: group, name: 'Other 2') - - visit budget_executions_path(budget) - - expect(page).to have_css('.budget-execution', count: 3) - expect(city_heading.name).to appear_before(other_heading1.name) - expect(city_heading.name).to appear_before(other_heading2.name) - end - scenario 'Non-city headings are displayed in alphabetical order' do heading.destroy! z_heading = create_heading_with_investment_with_milestone(group: group, name: 'Zzz')