Remove city heading specific code

This code accidentally made it to consul, and it's specific to Madrid.
This commit is contained in:
Javi Martín
2018-11-13 12:53:02 +01:00
parent 0de8c884ac
commit 91d91f2ebf
2 changed files with 3 additions and 24 deletions

View File

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

View File

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