mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Add description to sqm_category
This commit is contained in:
parent
f8166aed47
commit
6a101eab76
4 changed files with 169 additions and 160 deletions
|
|
@ -0,0 +1,5 @@
|
|||
class AddDescriptionToSqmCategory < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :sqm_categories, :description, :text
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20210923113404) do
|
||||
ActiveRecord::Schema.define(version: 20211005145740) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
@ -205,6 +205,7 @@ ActiveRecord::Schema.define(version: 20210923113404) do
|
|||
|
||||
create_table "sqm_categories", id: :serial, force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
end
|
||||
|
||||
create_table "students", id: :serial, force: :cascade do |t|
|
||||
|
|
|
|||
|
|
@ -35,8 +35,11 @@ CSV.parse(measure_key_2021, headers: true).each do |row|
|
|||
|
||||
category_name = row['Category']
|
||||
|
||||
if SqmCategory.find_by_name(category_name).nil?
|
||||
SqmCategory.create name: category_name
|
||||
category = SqmCategory.find_or_create_by(name: category_name)
|
||||
|
||||
if category.description.nil?
|
||||
category.description = row['Category Description']
|
||||
category.save
|
||||
end
|
||||
|
||||
subcategory_name = row['Subcategory']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue