mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
sorting categories on boston pages
This commit is contained in:
parent
ed9329e912
commit
adc8c96b1b
1 changed files with 3 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue