Skip to content

Commit efb148a

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 c7a73a0 commit efb148a

14 files changed

Lines changed: 28 additions & 28 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
@@ -252,11 +252,11 @@ def find_or_create_by_name!(klass, name, **attrs, &block)
252252

253253
puts "Creating WindowsTypes…"
254254
adult_type = WindowsType.where(name: "ADULT WINDOWS")
255-
.first_or_create!(legacy_id: 1, short_name: "ADULT")
255+
.first_or_create!(legacy_id: 1, short_name: "Adult")
256256
childrens_type = WindowsType.where(name: "CHILDREN'S WINDOWS")
257-
.first_or_create!(legacy_id: 2, short_name: "CHILDREN")
257+
.first_or_create!(legacy_id: 2, short_name: "Children")
258258
combined_type = WindowsType.where(name: "ADULT & CHILDREN COMBINED (FAMILY) WINDOWS")
259-
.first_or_create!(legacy_id: 3, short_name: "COMBINED")
259+
.first_or_create!(legacy_id: 3, short_name: "Combined")
260260

261261
puts "Creating FormBuilders…"
262262
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 },

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
@@ -91,8 +91,8 @@
9191

9292
let(:org_alpha) { create(:organization, name: "Alpha Org") }
9393
let(:org_zulu) { create(:organization, name: "Zulu Org") }
94-
let(:wt_adult) { create(:windows_type, short_name: "ADULT") }
95-
let(:wt_children) { create(:windows_type, short_name: "CHILDREN") }
94+
let(:wt_adult) { create(:windows_type, short_name: "Adult") }
95+
let(:wt_children) { create(:windows_type, short_name: "Children") }
9696
let(:ws_art) { create(:workshop, title: "Art Workshop") }
9797
let(:ws_music) { create(:workshop, title: "Music Workshop") }
9898

spec/system/person_submits_workshop_log_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
create(:person, user: @user)
99

1010
adult_window = create(:windows_type, :adult)
11-
@windows_type = create(:windows_type, short_name: "COMBINED")
11+
@windows_type = create(:windows_type, short_name: "Combined")
1212

1313
@form_builder = FormBuilder.create!(windows_type_id: @windows_type.id, name: "The form")
1414
@form_builder.forms.create!

0 commit comments

Comments
 (0)