Skip to content

Commit c4c4d7c

Browse files
maebealeclaude
andcommitted
Titleize windows type short_names across codebase
ADULT → Adult, CHILDREN → Children, COMBINED → Combined. Updates seeds, factories, controller lookups, rake tasks, and specs to match production data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a492a36 commit c4c4d7c

15 files changed

Lines changed: 29 additions & 29 deletions

app/controllers/monthly_reports_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def find_workshop_logs
209209
end
210210

211211
def find_combined_workshop_logs(agency_id)
212-
combined_windows_type = WindowsType.where(short_name: "COMBINED").first
212+
combined_windows_type = WindowsType.where(short_name: "Combined").first
213213
@combined_workshop_logs = current_user.organization_workshop_logs(
214214
@report.date, combined_windows_type, agency_id)
215215
end

app/controllers/workshop_log_creation_wizard_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def show
88
authorize! :workshop_log_creation_wizard, to: :show?
99
@user = current_user
1010
@agencies = current_user.organizations
11-
windows_type_id = params[:windows_type_id] || WindowsType.where(short_name: "COMBINED")
11+
windows_type_id = params[:windows_type_id] || WindowsType.where(short_name: "Combined")
1212
@windows_type = WindowsType.find(windows_type_id) if windows_type_id
1313
send(step)
1414
render_wizard

app/controllers/workshop_logs_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def set_form_variables
192192
# @files = MediaFile.where(["workshop_log_id = ?", @workshop_log.id])
193193

194194
@windows_type_id = params[:windows_type_id].presence || @workshop.windows_type_id ||
195-
WindowsType.where(short_name: "COMBINED").last.id
195+
WindowsType.where(short_name: "Combined").last.id
196196
form = FormBuilder.where(windows_type_id: @windows_type_id)
197197
.first&.forms.first # because there's only one form per form_builder
198198
if form

app/controllers/workshops_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def summary
4545
@total_ongoing = logs.reduce(0) { |sum, l| sum += l.num_ongoing }
4646
@total_first_time = logs.reduce(0) { |sum, l| sum += l.num_first_time }
4747

48-
combined_windows_type = WindowsType.where(short_name: "COMBINED").first
48+
combined_windows_type = WindowsType.where(short_name: "Combined").first
4949
@combined_workshop_logs = current_user.organization_workshop_logs(
5050
@report.date, combined_windows_type, current_user.agency_id
5151
)

db/seeds.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ def find_or_create_by_name!(klass, name, **attrs, &block)
6666

6767
puts "Creating WindowsTypes…"
6868
adult_type = WindowsType.where(name: "ADULT WINDOWS")
69-
.first_or_create!(legacy_id: 1, short_name: "ADULT")
69+
.first_or_create!(legacy_id: 1, short_name: "Adult")
7070
childrens_type = WindowsType.where(name: "CHILDREN'S WINDOWS")
71-
.first_or_create!(legacy_id: 2, short_name: "CHILDREN")
71+
.first_or_create!(legacy_id: 2, short_name: "Children")
7272
combined_type = WindowsType.where(name: "ADULT & CHILDREN COMBINED (FAMILY) WINDOWS")
73-
.first_or_create!(legacy_id: 3, short_name: "COMBINED")
73+
.first_or_create!(legacy_id: 3, short_name: "Combined")
7474

7575
puts "Creating FormBuilders…"
7676
FormBuilder.where(name: "Adult Monthly Report", windows_type: adult_type).first_or_create!(id: 4)

db/seeds/dummy_dev_seeds.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
pending_status = OrganizationStatus.find_by!(name: "Pending")
55
suspended_status = OrganizationStatus.find_by!(name: "Suspended")
66

7-
adult_wt = WindowsType.find_by!(short_name: "ADULT")
8-
children_wt = WindowsType.find_by!(short_name: "CHILDREN")
9-
combined_wt = WindowsType.find_by!(short_name: "COMBINED")
7+
adult_wt = WindowsType.find_by!(short_name: "Adult")
8+
children_wt = WindowsType.find_by!(short_name: "Children")
9+
combined_wt = WindowsType.find_by!(short_name: "Combined")
1010

1111
[
1212
{ name: "1736 Family Crisis Center", organization_status: inactive_status, windows_type: adult_wt },

lib/tasks/story_data.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace :story_data do
1919
spotlighted_facilitator_id: nil,
2020
story_idea_id: nil,
2121
website_url: resource.url,
22-
windows_type_id: resource.windows_type_id || WindowsType.where(short_name: "COMBINED").first.id,
22+
windows_type_id: resource.windows_type_id || WindowsType.where(short_name: "Combined").first.id,
2323
workshop_id: resource.workshop_id,
2424
youtube_url: nil, # resources don't store this, add mapping if needed
2525
created_at: resource.created_at,

spec/factories/windows_types.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66
trait :adult do
77
name { "ADULT WINDOWS" }
8-
short_name { "ADULT" }
8+
short_name { "Adult" }
99
end
1010

1111
trait :children do
1212
name { "CHILDREN'S WINDOWS" }
13-
short_name { "CHILDREN" }
13+
short_name { "Children" }
1414
end
1515

1616
trait :combined do
1717
name { "ADULT & CHILDREN COMBINED (FAMILY) WINDOWS" }
18-
short_name { "COMBINED" }
18+
short_name { "Combined" }
1919
end
2020
end
2121
end

spec/models/workshop_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
it 'returns title + windows type (when present) + # + id' do
6464
record = create(:workshop, title: 'The best workshop in the world', windows_type: create(:windows_type, :adult))
6565

66-
expect(record.type_name).to eq "The best workshop in the world (ADULT) ##{record.id}"
66+
expect(record.type_name).to eq "The best workshop in the world (Adult) ##{record.id}"
6767
end
6868

6969
it 'omits the windows type part when there is no windows_type' do

spec/requests/stories_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858

5959
let(:org_alpha) { create(:organization, name: "Alpha Org") }
6060
let(:org_zulu) { create(:organization, name: "Zulu Org") }
61-
let(:wt_adult) { create(:windows_type, short_name: "ADULT") }
62-
let(:wt_children) { create(:windows_type, short_name: "CHILDREN") }
61+
let(:wt_adult) { create(:windows_type, short_name: "Adult") }
62+
let(:wt_children) { create(:windows_type, short_name: "Children") }
6363
let(:ws_art) { create(:workshop, title: "Art Workshop") }
6464
let(:ws_music) { create(:workshop, title: "Music Workshop") }
6565

0 commit comments

Comments
 (0)