Skip to content

Commit 933a162

Browse files
Updated the order of columns in the partners export to match the order of fields in the partner profile form
1 parent 520942c commit 933a162

4 files changed

Lines changed: 233 additions & 252 deletions

File tree

app/models/partners/profile.rb

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -142,37 +142,38 @@ class Profile < Base
142142
validate :has_at_least_one_request_setting
143143
validate :pick_up_email_addresses
144144

145-
# For the sake of documentation, here are the partials each field belongs to.
146-
# agency_distribution_information
147-
# distribution_times, more_docs_required, new_client_times
148-
# agency_information -- this partial is always shown
145+
# For the sake of documentation, here are the partials each field belongs to. In the order those
146+
# partials appear in the actual form.
147+
# agency_information -- this partial is always shown, contains the agency information AND the Program / Delivery Address sections of the form
149148
# agency_type, other_agency_type, agency_mission, address1, address2, city, state, zip_code,
150149
# program_address1, program_address2, program_city, program_state, program_zip_code
150+
# media_information
151+
# website, facebook, twitter, instagram, no_social_media_presence
151152
# agency_stability
152-
# case_management, currently_provide_diapers, essentials_use, evidence_based, form_990,
153-
# founded, program_age, program_description, program_name, receives_essentials_from_other
153+
# founded, form_990, program_name, program_description, program_age, evidence_based, case_management,
154+
# essentials_use, receives_essentials_from_other, currently_provide_diapers
155+
# organizational_capacity
156+
# client_capacity, storage_space, describe_storage_space
157+
# sources_of_funding
158+
# sources_of_funding, sources_of_diapers, essentials_budget, essentials_funding_source
154159
# area_served
155160
# has no associated Partners::Profile fields
156-
# attached_documents
157-
# has no associated Partners::Profile fields
161+
# population_served
162+
# income_requirement_desc, income_verification, population_black, population_white,
163+
# population_hispanic, population_asian, population_american_indian, population_island,
164+
# population_multi_racial, population_other, zips_served, at_fpl_or_below, above_1_2_times_fpl
165+
# greater_2_times_fpl, poverty_unknown
158166
# executive_director
159167
# executive_director_name, executive_director_phone, executive_director_email, primary_contact_name,
160168
# primary_contact_phone, primary_contact_mobile, primary_contact_email
161-
# media_information
162-
# facebook, instagram, no_social_media_presence, twitter
163-
# organizational_capacity
164-
# client_capacity, describe_storage_space, storage_space
165-
# partner_settings -- this partial is always shown
166-
# enable_quantity_based_requests, enable_child_based_requests, enable_individual_requests
167169
# pick_up_person
168170
# pick_up_name, pick_up_phone, pick_up_email
169-
# population_served
170-
# above_1_2_times_fpl, at_fpl_or_below, greater_2_times_fpl, income_requirement_desc,
171-
# income_verification, population_american_indian, population_asian, population_black,
172-
# population_hispanic, population_island, population_multi_racial, population_other,
173-
# population_white, poverty_unknown, zips_served
174-
# sources_of_funding
175-
# essentials_budget, essentials_funding_source, sources_of_diapers, sources_of_funding
171+
# agency_distribution_information
172+
# distribution_times, new_client_times, more_docs_required
173+
# attached_documents
174+
# has no associated Partners::Profile fields
175+
# partner_settings -- this partial is always shown
176+
# enable_quantity_based_requests, enable_child_based_requests, enable_individual_requests
176177

177178
# These are columns which currently do not appear in any partial of the profile form.
178179
# It is possible these will be removed in the future.

app/services/exports/export_partners_csv_service.rb

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,15 @@ def base_table
3131
table = {
3232
"Agency Name" => ->(partner) { partner.name },
3333
"Agency Email" => ->(partner) { partner.email },
34-
"Agency Address" => ->(partner) { "#{partner.profile.address1}, #{partner.profile.address2}" },
35-
"Agency City" => ->(partner) { partner.profile.city },
36-
"Agency State" => ->(partner) { partner.profile.state },
37-
"Agency Zip Code" => ->(partner) { partner.profile.zip_code },
38-
"Agency Website" => ->(partner) { partner.profile.website },
3934
"Agency Type" => ->(partner) {
4035
symbolic_agency_type = partner.profile.agency_type&.to_sym
4136
(symbolic_agency_type == :other) ? "#{I18n.t symbolic_agency_type, scope: :partners_profile}: #{partner.profile.other_agency_type}" : (I18n.t symbolic_agency_type, scope: :partners_profile)
4237
},
43-
"Contact Name" => ->(partner) { partner.profile.primary_contact_name },
44-
"Contact Phone" => ->(partner) { partner.profile.primary_contact_phone },
45-
"Contact Cell" => ->(partner) { partner.profile.primary_contact_mobile },
46-
"Contact Email" => ->(partner) { partner.profile.primary_contact_email },
47-
"Agency Mission" => ->(partner) { partner.profile.agency_mission }, # The agency_information and partner_settings partials are always shown
48-
"Child-based Requests" => ->(partner) { partner.profile.enable_child_based_requests },
49-
"Individual Requests" => ->(partner) { partner.profile.enable_individual_requests },
50-
"Quantity-based Requests" => ->(partner) { partner.profile.enable_quantity_based_requests },
38+
"Agency Mission" => ->(partner) { partner.profile.agency_mission },
39+
"Agency Address" => ->(partner) { "#{partner.profile.address1}, #{partner.profile.address2}" },
40+
"Agency City" => ->(partner) { partner.profile.city },
41+
"Agency State" => ->(partner) { partner.profile.state },
42+
"Agency Zip Code" => ->(partner) { partner.profile.zip_code },
5143
"Program/Delivery Address" => ->(partner) { "#{partner.profile.program_address1}, #{partner.profile.program_address2}" },
5244
"Program City" => ->(partner) { partner.profile.program_city },
5345
"Program State" => ->(partner) { partner.profile.program_state },
@@ -59,6 +51,7 @@ def base_table
5951
}
6052

6153
if @partials_to_show.include? "media_information"
54+
table["Agency Website"] = ->(partner) { partner.profile.website }
6255
table["Facebook"] = ->(partner) { partner.profile.facebook }
6356
table["Twitter"] = ->(partner) { partner.profile.twitter }
6457
table["Instagram"] = ->(partner) { partner.profile.instagram }
@@ -113,6 +106,10 @@ def base_table
113106
table["Executive Director Name"] = ->(partner) { partner.profile.executive_director_name }
114107
table["Executive Director Phone"] = ->(partner) { partner.profile.executive_director_phone }
115108
table["Executive Director Email"] = ->(partner) { partner.profile.executive_director_email }
109+
table["Contact Name"] = ->(partner) { partner.profile.primary_contact_name }
110+
table["Contact Phone"] = ->(partner) { partner.profile.primary_contact_phone }
111+
table["Contact Cell"] = ->(partner) { partner.profile.primary_contact_mobile }
112+
table["Contact Email"] = ->(partner) { partner.profile.primary_contact_email }
116113
end
117114

118115
if @partials_to_show.include? "pick_up_person"
@@ -127,6 +124,10 @@ def base_table
127124
table["More Docs Required"] = ->(partner) { partner.profile.more_docs_required }
128125
end
129126

127+
table["Quantity-based Requests"] = ->(partner) { partner.profile.enable_quantity_based_requests }
128+
table["Child-based Requests"] = ->(partner) { partner.profile.enable_child_based_requests }
129+
table["Individual Requests"] = ->(partner) { partner.profile.enable_individual_requests }
130+
130131
table
131132
end
132133

0 commit comments

Comments
 (0)