Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/monthly_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/workshop_log_creation_wizard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/workshop_logs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/workshops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
6 changes: 3 additions & 3 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions db/seeds/dummy_dev_seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/story_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions spec/factories/windows_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/models/workshop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/stories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") }

Expand Down
2 changes: 1 addition & 1 deletion spec/system/person_submits_workshop_log_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
12 changes: 6 additions & 6 deletions spec/system/person_submits_workshop_variation_idea_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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("<p>Variation for a single-org user.</p>")
select "I would like my full name published with the story",
from: "workshop_variation_idea_author_credit_preference"
Expand Down Expand Up @@ -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("<p>Variation for a multi-org user.</p>")
select "I would like my full name published with the story",
Expand Down
2 changes: 1 addition & 1 deletion spec/system/person_views_workshop_logs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
4 changes: 2 additions & 2 deletions spec/views/windows_types/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]))
Expand Down
4 changes: 2 additions & 2 deletions spec/views/windows_types/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -11,6 +11,6 @@

it "renders attributes in <p>" do
render
expect(rendered).to include(/ADULT/)
expect(rendered).to include(/Adult/)
end
end