sorting categories on boston pages

pull/1/head
Jared Cosulich 7 years ago
parent ed9329e912
commit adc8c96b1b

@ -8,7 +8,8 @@
%h3 Insufficient Responses
%p No data is displayed for this school because of insufficient responses.
- elsif @district.name == "Boston"
- grouped = @school_categories.inject({}) do |hash, item|
- sorted_categories = @school_categories.sort { |a, b| "#{a.category.path.first.name} #{a.category.name}" <=> "#{b.category.path.first.name} #{b.category.name}" }
- grouped = sorted_categories.inject({}) do |hash, item|
- all = hash[item.category.path.first] || []
- all << item
- hash[item.category.path.first] = all
@ -18,7 +19,7 @@
.col-12
%h3= root_category.name
.row
= render group.sort { |a, b| a.category.name <=> b.category.name }
= render group
- else
.row
= render @school_categories.sort { |a, b| a.root_index <=> b.root_index }

Loading…
Cancel
Save