From 865b7b17afe6f72001ae942c165f12bc92d8ab5a Mon Sep 17 00:00:00 2001 From: Nelson Jovel Date: Thu, 4 Jan 2024 20:15:33 -0800 Subject: [PATCH] Able to create schools now --- app/models/dashboard/school.rb | 2 +- app/models/dashboard/survey_item.rb | 6 +++--- ...40103233517_create_dashboard_categories.rb | 2 +- ...04005325_create_dashboard_subcategories.rb | 2 +- ...240104173931_create_dashboard_districts.rb | 2 +- ...20240104174053_create_dashboard_schools.rb | 4 ++-- .../20240104174458_create_dashboard_ells.rb | 2 +- ...20240104174649_create_dashboard_incomes.rb | 2 +- .../20240104181033_create_dashboard_races.rb | 2 +- .../20240104183934_create_dashboard_speds.rb | 2 +- spec/dummy/db/schema.rb | 19 +++++++++++++------ 11 files changed, 26 insertions(+), 19 deletions(-) diff --git a/app/models/dashboard/school.rb b/app/models/dashboard/school.rb index c5588ee..1a24ae9 100644 --- a/app/models/dashboard/school.rb +++ b/app/models/dashboard/school.rb @@ -1,6 +1,6 @@ module Dashboard class School < ApplicationRecord - belongs_to :district, class_name: "Dashboard::District" + belongs_to :dashboard_district, class_name: "Dashboard::District" has_many :dashboard_survey_item_responses, dependent: :delete_all diff --git a/app/models/dashboard/survey_item.rb b/app/models/dashboard/survey_item.rb index 3a78e20..40621c1 100644 --- a/app/models/dashboard/survey_item.rb +++ b/app/models/dashboard/survey_item.rb @@ -1,9 +1,9 @@ module Dashboard class SurveyItem < ApplicationRecord - belongs_to :dashboard_scale + # belongs_to :dashboard_scale - has_one :dashboard_measure, through: dashboard_scale - has_one :dashboard_subcategory, through: dashboard_measure + # has_one :dashboard_measure, through: dashboard_scale + # has_one :dashboard_subcategory, through: dashboard_measure has_many :dashboard_survey_item_responses diff --git a/db/migrate/20240103233517_create_dashboard_categories.rb b/db/migrate/20240103233517_create_dashboard_categories.rb index d01a90d..a799571 100644 --- a/db/migrate/20240103233517_create_dashboard_categories.rb +++ b/db/migrate/20240103233517_create_dashboard_categories.rb @@ -3,7 +3,7 @@ class CreateDashboardCategories < ActiveRecord::Migration[7.1] create_table :dashboard_categories do |t| t.string :name t.text :description - t.string :slug, unique: true + t.string :slug t.string :category_id t.string :short_description diff --git a/db/migrate/20240104005325_create_dashboard_subcategories.rb b/db/migrate/20240104005325_create_dashboard_subcategories.rb index 0d4ff2c..1c2cda8 100644 --- a/db/migrate/20240104005325_create_dashboard_subcategories.rb +++ b/db/migrate/20240104005325_create_dashboard_subcategories.rb @@ -4,7 +4,7 @@ class CreateDashboardSubcategories < ActiveRecord::Migration[7.1] t.string :name t.text :description t.string :subcategory_id - t.references :dashboard_category_id, null: false, foreign_key: true + t.references :dashboard_categories, null: false, foreign_key: true t.timestamps end diff --git a/db/migrate/20240104173931_create_dashboard_districts.rb b/db/migrate/20240104173931_create_dashboard_districts.rb index 8bdc25d..e494169 100644 --- a/db/migrate/20240104173931_create_dashboard_districts.rb +++ b/db/migrate/20240104173931_create_dashboard_districts.rb @@ -2,7 +2,7 @@ class CreateDashboardDistricts < ActiveRecord::Migration[7.1] def change create_table :dashboard_districts do |t| t.string :name - t.string :slug, unique: true + t.string :slug t.integer :qualtrics_code t.timestamps diff --git a/db/migrate/20240104174053_create_dashboard_schools.rb b/db/migrate/20240104174053_create_dashboard_schools.rb index 10b5cd6..45814c5 100644 --- a/db/migrate/20240104174053_create_dashboard_schools.rb +++ b/db/migrate/20240104174053_create_dashboard_schools.rb @@ -2,9 +2,9 @@ class CreateDashboardSchools < ActiveRecord::Migration[7.1] def change create_table :dashboard_schools do |t| t.string :name - t.references :dashboard_district_id, null: false, foreign_key: true + t.references :dashboard_district, null: false, foreign_key: true t.text :description - t.string :slug, unique: true + t.string :slug t.integer :qualtrics_code t.integer :dese_id t.boolean :is_hs diff --git a/db/migrate/20240104174458_create_dashboard_ells.rb b/db/migrate/20240104174458_create_dashboard_ells.rb index 3e787d4..42b40dd 100644 --- a/db/migrate/20240104174458_create_dashboard_ells.rb +++ b/db/migrate/20240104174458_create_dashboard_ells.rb @@ -2,7 +2,7 @@ class CreateDashboardElls < ActiveRecord::Migration[7.1] def change create_table :dashboard_ells do |t| t.string :designation - t.string :slug, unique: true + t.string :slug t.timestamps end diff --git a/db/migrate/20240104174649_create_dashboard_incomes.rb b/db/migrate/20240104174649_create_dashboard_incomes.rb index cb1d581..6bed9b1 100644 --- a/db/migrate/20240104174649_create_dashboard_incomes.rb +++ b/db/migrate/20240104174649_create_dashboard_incomes.rb @@ -2,7 +2,7 @@ class CreateDashboardIncomes < ActiveRecord::Migration[7.1] def change create_table :dashboard_incomes do |t| t.string :designation - t.string :slug, unique: true + t.string :slug t.timestamps end diff --git a/db/migrate/20240104181033_create_dashboard_races.rb b/db/migrate/20240104181033_create_dashboard_races.rb index 217646e..96fab9c 100644 --- a/db/migrate/20240104181033_create_dashboard_races.rb +++ b/db/migrate/20240104181033_create_dashboard_races.rb @@ -3,7 +3,7 @@ class CreateDashboardRaces < ActiveRecord::Migration[7.1] create_table :dashboard_races do |t| t.string :designation t.integer :qualtrics_code - t.string :slug, unique: true + t.string :slug t.timestamps end diff --git a/db/migrate/20240104183934_create_dashboard_speds.rb b/db/migrate/20240104183934_create_dashboard_speds.rb index ca23115..c64b527 100644 --- a/db/migrate/20240104183934_create_dashboard_speds.rb +++ b/db/migrate/20240104183934_create_dashboard_speds.rb @@ -2,7 +2,7 @@ class CreateDashboardSpeds < ActiveRecord::Migration[7.1] def change create_table :dashboard_speds do |t| t.string :designation - t.string :slug, unique: true + t.string :slug t.timestamps end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 1535b78..d5d7af1 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_01_04_192128) do +ActiveRecord::Schema[7.1].define(version: 2024_01_05_040909) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -47,6 +47,13 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_04_192128) do t.index ["dashboard_school_id"], name: "index_dashboard_admin_data_values_on_dashboard_school_id" end + create_table "dashboard_atoms", force: :cascade do |t| + t.integer "survey_item" + t.text "text" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "dashboard_categories", force: :cascade do |t| t.string "name" t.text "description" @@ -217,11 +224,11 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_04_192128) do t.bigint "dashboard_school_id", null: false t.bigint "dashboard_survey_item_id", null: false t.bigint "dashboard_academic_year_id", null: false - t.bigint "dashboard_student_id", null: false - t.bigint "dashboard_gender_id", null: false - t.bigint "dashboard_income_id", null: false - t.bigint "dashboard_ell_id", null: false - t.bigint "dashboard_sped_id", null: false + t.bigint "dashboard_student_id" + t.bigint "dashboard_gender_id" + t.bigint "dashboard_income_id" + t.bigint "dashboard_ell_id" + t.bigint "dashboard_sped_id" t.string "response_id" t.integer "grade" t.datetime "recorded_date"