Skip to content

Commit ee35185

Browse files
Added partials_to_show function to the Organization model, reworked the Partner model to refer to Organization model for the partials_to_show and ALL_PARTIALS
1 parent a45baa4 commit ee35185

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

app/models/organization.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ def address_changed?
167167
street_changed? || city_changed? || state_changed? || zipcode_changed?
168168
end
169169

170+
def partials_to_show
171+
partner_form_fields.presence || ALL_PARTIALS.map{|partial| partial[1]}
172+
end
173+
170174
def self.seed_items(organization = Organization.all)
171175
base_items = BaseItem.without_kit.map(&:to_h)
172176

app/models/partner.rb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,7 @@ class Partner < ApplicationRecord
6666
where(status: status.to_sym)
6767
}
6868

69-
ALL_PARTIALS = %w[
70-
media_information
71-
agency_stability
72-
organizational_capacity
73-
sources_of_funding
74-
area_served
75-
population_served
76-
executive_director
77-
pick_up_person
78-
agency_distribution_information
79-
attached_documents
80-
].freeze
69+
ALL_PARTIALS = Organization::ALL_PARTIALS.map{|partial| partial[1]}.freeze
8170

8271
# @return [String]
8372
def display_status
@@ -127,7 +116,7 @@ def self.import_csv(csv, organization_id)
127116
end
128117

129118
def partials_to_show
130-
organization.partner_form_fields.presence || ALL_PARTIALS
119+
organization.partials_to_show
131120
end
132121

133122
def quantity_year_to_date

0 commit comments

Comments
 (0)