mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
parent
340bdad831
commit
000bb52e1d
16 changed files with 239 additions and 191 deletions
|
|
@ -0,0 +1,5 @@
|
|||
class AddDescriptionToSubcategory < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :subcategories, :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: 20211005145740) do
|
||||
ActiveRecord::Schema.define(version: 20211005192509) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
@ -223,6 +223,7 @@ ActiveRecord::Schema.define(version: 20211005145740) do
|
|||
create_table "subcategories", id: :serial, force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.integer "sqm_category_id"
|
||||
t.text "description"
|
||||
end
|
||||
|
||||
create_table "survey_item_responses", id: :serial, force: :cascade do |t|
|
||||
|
|
|
|||
|
|
@ -44,8 +44,9 @@ CSV.parse(measure_key_2021, headers: true).each do |row|
|
|||
|
||||
subcategory_name = row['Subcategory']
|
||||
|
||||
if Subcategory.find_by_name(subcategory_name).nil?
|
||||
Subcategory.create sqm_category: SqmCategory.find_by_name(category_name), name: subcategory_name
|
||||
subcategory = Subcategory.find_or_create_by(name: subcategory_name, sqm_category: category)
|
||||
if subcategory.description.nil?
|
||||
subcategory.update(description: row['Subcategory Description'])
|
||||
end
|
||||
|
||||
measure_id = row['Measure Id']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue