mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
Completes Sub Categories and Measures for "All " Category Tabs -
Milford High School (Milford District). Add tabs to top navigation [#179727241]
This commit is contained in:
parent
5595af15b6
commit
a406205e20
16 changed files with 106 additions and 17 deletions
6
db/migrate/20211007190742_add_slug_to_sqm_category.rb
Normal file
6
db/migrate/20211007190742_add_slug_to_sqm_category.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class AddSlugToSqmCategory < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :sqm_categories, :slug, :string
|
||||
add_index :sqm_categories, :slug, unique: true
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddSortIndexToSqmCategory < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :sqm_categories, :sort_index, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20211006174717) do
|
||||
ActiveRecord::Schema.define(version: 20211007204840) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
@ -207,6 +207,9 @@ ActiveRecord::Schema.define(version: 20211006174717) do
|
|||
create_table "sqm_categories", id: :serial, force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.string "slug"
|
||||
t.integer "sort_index"
|
||||
t.index ["slug"], name: "index_sqm_categories_on_slug", unique: true
|
||||
end
|
||||
|
||||
create_table "students", id: :serial, force: :cascade do |t|
|
||||
|
|
|
|||
15
db/seeds.rb
15
db/seeds.rb
|
|
@ -37,9 +37,18 @@ CSV.parse(measure_key_2021, headers: true).each do |row|
|
|||
|
||||
category = SqmCategory.find_or_create_by(name: category_name)
|
||||
|
||||
if category.description.nil?
|
||||
category.update(description: row['Category Description'])
|
||||
end
|
||||
category_slugs = {
|
||||
'Teachers & Leadership' => 'teachers-and-leadership',
|
||||
'School Culture' => 'school-culture',
|
||||
'Resources' => 'resources',
|
||||
'Academic Learning' => 'academic-learning',
|
||||
'Citizenship & Wellbeing' => 'citizenship-and-wellbeing',
|
||||
}
|
||||
|
||||
category.description = row['Category Description']
|
||||
category.slug = category_slugs[category_name]
|
||||
category.sort_index = category_slugs.keys.index(category_name)
|
||||
category.save
|
||||
|
||||
subcategory_name = row['Subcategory']
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue