diff --git a/app/controllers/monthly_reports_controller.rb b/app/controllers/monthly_reports_controller.rb index b91c1059b..25626f589 100644 --- a/app/controllers/monthly_reports_controller.rb +++ b/app/controllers/monthly_reports_controller.rb @@ -209,7 +209,7 @@ def find_workshop_logs end def find_combined_workshop_logs(agency_id) - combined_windows_type = WindowsType.where(short_name: "COMBINED").first + combined_windows_type = WindowsType.where(short_name: "Combined").first @combined_workshop_logs = current_user.organization_workshop_logs( @report.date, combined_windows_type, agency_id) end diff --git a/app/controllers/workshop_log_creation_wizard_controller.rb b/app/controllers/workshop_log_creation_wizard_controller.rb index 4fe13ea03..7f94e3c4d 100644 --- a/app/controllers/workshop_log_creation_wizard_controller.rb +++ b/app/controllers/workshop_log_creation_wizard_controller.rb @@ -8,7 +8,7 @@ def show authorize! :workshop_log_creation_wizard, to: :show? @user = current_user @agencies = current_user.organizations - windows_type_id = params[:windows_type_id] || WindowsType.where(short_name: "COMBINED") + windows_type_id = params[:windows_type_id] || WindowsType.where(short_name: "Combined") @windows_type = WindowsType.find(windows_type_id) if windows_type_id send(step) render_wizard diff --git a/app/controllers/workshop_logs_controller.rb b/app/controllers/workshop_logs_controller.rb index c7b4e1fe4..f01fe79c8 100644 --- a/app/controllers/workshop_logs_controller.rb +++ b/app/controllers/workshop_logs_controller.rb @@ -192,7 +192,7 @@ def set_form_variables # @files = MediaFile.where(["workshop_log_id = ?", @workshop_log.id]) @windows_type_id = params[:windows_type_id].presence || @workshop.windows_type_id || - WindowsType.where(short_name: "COMBINED").last.id + WindowsType.where(short_name: "Combined").last.id form = FormBuilder.where(windows_type_id: @windows_type_id) .first&.forms.first # because there's only one form per form_builder if form diff --git a/app/controllers/workshops_controller.rb b/app/controllers/workshops_controller.rb index 03ac9f226..0fcaa233d 100644 --- a/app/controllers/workshops_controller.rb +++ b/app/controllers/workshops_controller.rb @@ -45,7 +45,7 @@ def summary @total_ongoing = logs.reduce(0) { |sum, l| sum += l.num_ongoing } @total_first_time = logs.reduce(0) { |sum, l| sum += l.num_first_time } - combined_windows_type = WindowsType.where(short_name: "COMBINED").first + combined_windows_type = WindowsType.where(short_name: "Combined").first @combined_workshop_logs = current_user.organization_workshop_logs( @report.date, combined_windows_type, current_user.agency_id ) diff --git a/db/seeds.rb b/db/seeds.rb index be5255c60..b09243fdd 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -233,11 +233,11 @@ def find_or_create_by_name!(klass, name, **attrs, &block) puts "Creating WindowsTypes…" adult_type = WindowsType.where(name: "ADULT WINDOWS") - .first_or_create!(legacy_id: 1, short_name: "ADULT") + .first_or_create!(legacy_id: 1, short_name: "Adult") childrens_type = WindowsType.where(name: "CHILDREN'S WINDOWS") - .first_or_create!(legacy_id: 2, short_name: "CHILDREN") + .first_or_create!(legacy_id: 2, short_name: "Children") combined_type = WindowsType.where(name: "ADULT & CHILDREN COMBINED (FAMILY) WINDOWS") - .first_or_create!(legacy_id: 3, short_name: "COMBINED") + .first_or_create!(legacy_id: 3, short_name: "Combined") puts "Creating FormBuilders…" FormBuilder.where(name: "Adult Monthly Report", windows_type: adult_type).first_or_create!(id: 4) diff --git a/db/seeds/dummy_dev_seeds.rb b/db/seeds/dummy_dev_seeds.rb index 9cf0f20d0..838029c85 100644 --- a/db/seeds/dummy_dev_seeds.rb +++ b/db/seeds/dummy_dev_seeds.rb @@ -4,9 +4,9 @@ pending_status = OrganizationStatus.find_by!(name: "Pending") suspended_status = OrganizationStatus.find_by!(name: "Suspended") -adult_wt = WindowsType.find_by!(short_name: "ADULT") -children_wt = WindowsType.find_by!(short_name: "CHILDREN") -combined_wt = WindowsType.find_by!(short_name: "COMBINED") +adult_wt = WindowsType.find_by!(short_name: "Adult") +children_wt = WindowsType.find_by!(short_name: "Children") +combined_wt = WindowsType.find_by!(short_name: "Combined") [ { name: "1736 Family Crisis Center", organization_status: inactive_status, windows_type: adult_wt }, diff --git a/lib/tasks/story_data.rake b/lib/tasks/story_data.rake index 8ea635a9e..23391164b 100644 --- a/lib/tasks/story_data.rake +++ b/lib/tasks/story_data.rake @@ -19,7 +19,7 @@ namespace :story_data do spotlighted_facilitator_id: nil, story_idea_id: nil, website_url: resource.url, - windows_type_id: resource.windows_type_id || WindowsType.where(short_name: "COMBINED").first.id, + windows_type_id: resource.windows_type_id || WindowsType.where(short_name: "Combined").first.id, workshop_id: resource.workshop_id, youtube_url: nil, # resources don't store this, add mapping if needed created_at: resource.created_at, diff --git a/spec/factories/windows_types.rb b/spec/factories/windows_types.rb index 191a2d952..88cc0f33f 100644 --- a/spec/factories/windows_types.rb +++ b/spec/factories/windows_types.rb @@ -5,17 +5,17 @@ trait :adult do name { "ADULT WINDOWS" } - short_name { "ADULT" } + short_name { "Adult" } end trait :children do name { "CHILDREN'S WINDOWS" } - short_name { "CHILDREN" } + short_name { "Children" } end trait :combined do name { "ADULT & CHILDREN COMBINED (FAMILY) WINDOWS" } - short_name { "COMBINED" } + short_name { "Combined" } end end end diff --git a/spec/models/workshop_spec.rb b/spec/models/workshop_spec.rb index 6634cbb60..cc37c718a 100644 --- a/spec/models/workshop_spec.rb +++ b/spec/models/workshop_spec.rb @@ -63,7 +63,7 @@ it 'returns title + windows type (when present) + # + id' do record = create(:workshop, title: 'The best workshop in the world', windows_type: create(:windows_type, :adult)) - expect(record.type_name).to eq "The best workshop in the world (ADULT) ##{record.id}" + expect(record.type_name).to eq "The best workshop in the world (Adult) ##{record.id}" end it 'omits the windows type part when there is no windows_type' do diff --git a/spec/requests/stories_spec.rb b/spec/requests/stories_spec.rb index a825f06c1..201e77304 100644 --- a/spec/requests/stories_spec.rb +++ b/spec/requests/stories_spec.rb @@ -58,8 +58,8 @@ let(:org_alpha) { create(:organization, name: "Alpha Org") } let(:org_zulu) { create(:organization, name: "Zulu Org") } - let(:wt_adult) { create(:windows_type, short_name: "ADULT") } - let(:wt_children) { create(:windows_type, short_name: "CHILDREN") } + let(:wt_adult) { create(:windows_type, short_name: "Adult") } + let(:wt_children) { create(:windows_type, short_name: "Children") } let(:ws_art) { create(:workshop, title: "Art Workshop") } let(:ws_music) { create(:workshop, title: "Music Workshop") } diff --git a/spec/system/person_submits_workshop_log_test.rb b/spec/system/person_submits_workshop_log_test.rb index 360499d4c..263bddbb5 100644 --- a/spec/system/person_submits_workshop_log_test.rb +++ b/spec/system/person_submits_workshop_log_test.rb @@ -8,7 +8,7 @@ create(:person, user: @user) adult_window = create(:windows_type, :adult) - @windows_type = create(:windows_type, short_name: "COMBINED") + @windows_type = create(:windows_type, short_name: "Combined") @form_builder = FormBuilder.create!(windows_type_id: @windows_type.id, name: "The form") @form_builder.forms.create! diff --git a/spec/system/person_submits_workshop_variation_idea_test.rb b/spec/system/person_submits_workshop_variation_idea_test.rb index c31f8cd87..4aa3cc96a 100644 --- a/spec/system/person_submits_workshop_variation_idea_test.rb +++ b/spec/system/person_submits_workshop_variation_idea_test.rb @@ -60,7 +60,7 @@ def fill_in_variation_idea_form(workshop_title:, windows_type_short_name:, organ fill_in_variation_idea_form( workshop_title: "Healing Through Art", - windows_type_short_name: "ADULT", + windows_type_short_name: "Adult", organization: organization ) @@ -92,7 +92,7 @@ def fill_in_variation_idea_form(workshop_title:, windows_type_short_name:, organ fill_in_variation_idea_form( workshop_title: "Creative Expression", - windows_type_short_name: "ADULT", + windows_type_short_name: "Adult", organization: organization ) @@ -125,7 +125,7 @@ def fill_in_variation_idea_form(workshop_title:, windows_type_short_name:, organ fill_in_variation_idea_form( workshop_title: "Advanced Art Therapy", - windows_type_short_name: "ADULT", + windows_type_short_name: "Adult", organization: organization ) @@ -157,7 +157,7 @@ def fill_in_variation_idea_form(workshop_title:, windows_type_short_name:, organ fill_in_variation_idea_form( workshop_title: "Mindful Drawing", - windows_type_short_name: "ADULT", + windows_type_short_name: "Adult", organization: organization ) @@ -187,7 +187,7 @@ def fill_in_variation_idea_form(workshop_title:, windows_type_short_name:, organ fill_in "Variation name", with: "Single Org Variation" select_workshop_via_tom_select("Org Test Workshop") - select "ADULT", from: "workshop_variation_idea_windows_type_id" + select "Adult", from: "workshop_variation_idea_windows_type_id" fill_in_rhino_editor("
Variation for a single-org user.
") select "I would like my full name published with the story", from: "workshop_variation_idea_author_credit_preference" @@ -215,7 +215,7 @@ def fill_in_variation_idea_form(workshop_title:, windows_type_short_name:, organ fill_in "Variation name", with: "Multi Org Variation" select_workshop_via_tom_select("Org Test Workshop") - select "ADULT", from: "workshop_variation_idea_windows_type_id" + select "Adult", from: "workshop_variation_idea_windows_type_id" select_organization(organization) fill_in_rhino_editor("Variation for a multi-org user.
") select "I would like my full name published with the story", diff --git a/spec/system/person_views_workshop_logs_test.rb b/spec/system/person_views_workshop_logs_test.rb index 3dec09b7c..b784c6d62 100644 --- a/spec/system/person_views_workshop_logs_test.rb +++ b/spec/system/person_views_workshop_logs_test.rb @@ -8,7 +8,7 @@ @user = create(:user) create(:person, user: @user) - windows_type = create(:windows_type, short_name: "COMBINED") + windows_type = create(:windows_type, short_name: "Combined") form_builder = FormBuilder.create!(windows_type_id: windows_type.id, name: "The form") form_builder.forms.create! diff --git a/spec/views/windows_types/index.html.erb_spec.rb b/spec/views/windows_types/index.html.erb_spec.rb index ab4bfa89f..71af4ca3b 100644 --- a/spec/views/windows_types/index.html.erb_spec.rb +++ b/spec/views/windows_types/index.html.erb_spec.rb @@ -2,8 +2,8 @@ RSpec.describe "windows_types/index", type: :view do let(:admin) { create(:user, :admin) } - let(:windows_type1) { create(:windows_type, name: "Adult", short_name: "ADULT") } - let(:windows_type2) { create(:windows_type, name: "Children", short_name: "CHILDREN") } + let(:windows_type1) { create(:windows_type, name: "Adult", short_name: "Adult") } + let(:windows_type2) { create(:windows_type, name: "Children", short_name: "Children") } before(:each) do assign(:windows_types, paginated([ windows_type1, windows_type2 ])) diff --git a/spec/views/windows_types/show.html.erb_spec.rb b/spec/views/windows_types/show.html.erb_spec.rb index 2d01b13b1..bf017e9ee 100644 --- a/spec/views/windows_types/show.html.erb_spec.rb +++ b/spec/views/windows_types/show.html.erb_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "windows_types/show", type: :view do let(:admin) { create(:user, :admin) } - let(:windows_type) { create(:windows_type, name: "Adult", short_name: "ADULT") } + let(:windows_type) { create(:windows_type, name: "Adult", short_name: "Adult") } before(:each) do assign(:windows_type, windows_type) @@ -11,6 +11,6 @@ it "renders attributes in" do render - expect(rendered).to include(/ADULT/) + expect(rendered).to include(/Adult/) end end