Module: EffectiveMembershipsCategory

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/effective_memberships_category.rb

Overview

EffectiveMembershipsCategory

Mark your category model with effective_memberships_category to get all the includes

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#applicant_fee_qb_item_nameObject



243
244
245
# File 'app/models/concerns/effective_memberships_category.rb', line 243

def applicant_fee_qb_item_name
  'Applicant'
end

#applicant_fee_tax_exemptObject



247
248
249
# File 'app/models/concerns/effective_memberships_category.rb', line 247

def applicant_fee_tax_exempt
  tax_exempt
end

#applicant_reinstatement_wizard_stepsObject

Apply for Reinstatement



213
214
215
# File 'app/models/concerns/effective_memberships_category.rb', line 213

def applicant_reinstatement_wizard_steps
  [:reinstatement]
end

#applicant_review_wizard_stepsObject



221
222
223
# File 'app/models/concerns/effective_memberships_category.rb', line 221

def applicant_review_wizard_steps
  (Array(self[:applicant_review_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#applicant_wizard_stepsObject

Apply to Join or Apply to Reclassify



208
209
210
# File 'app/models/concerns/effective_memberships_category.rb', line 208

def applicant_wizard_steps
  (Array(self[:applicant_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#applicant_wizard_steps_collectionObject



225
226
227
228
229
230
231
232
# File 'app/models/concerns/effective_memberships_category.rb', line 225

def applicant_wizard_steps_collection
  wizard_steps = EffectiveMemberships.Applicant.wizard_steps_hash
  required_steps = EffectiveMemberships.Applicant.required_wizard_steps

  wizard_steps.map do |step, title|
    [title, step, 'disabled' => required_steps.include?(step)]
  end
end

#can_apply?Boolean

Returns:

  • (Boolean)


167
168
169
# File 'app/models/concerns/effective_memberships_category.rb', line 167

def can_apply?
  can_apply_new? || can_apply_existing? || can_apply_restricted?
end

#can_apply_restricted_idsObject



191
192
193
# File 'app/models/concerns/effective_memberships_category.rb', line 191

def can_apply_restricted_ids
  Array(self[:can_apply_restricted_ids]) - [nil, '']
end

#discount_fee(date:) ⇒ Object



187
188
189
# File 'app/models/concerns/effective_memberships_category.rb', line 187

def discount_fee(date:)
  0 - prorated_fee(date: date)
end

#fee_payment_wizard_stepsObject



217
218
219
# File 'app/models/concerns/effective_memberships_category.rb', line 217

def fee_payment_wizard_steps
  (Array(self[:fee_payment_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#fee_payment_wizard_steps_collectionObject



234
235
236
237
238
239
240
241
# File 'app/models/concerns/effective_memberships_category.rb', line 234

def fee_payment_wizard_steps_collection
  wizard_steps = EffectiveMemberships.FeePayment.wizard_steps_hash
  required_steps = EffectiveMemberships.FeePayment.required_wizard_steps

  wizard_steps.map do |step, title|
    [title, step, 'disabled' => required_steps.include?(step)]
  end
end

#individual?Boolean

Returns:

  • (Boolean)


171
172
173
# File 'app/models/concerns/effective_memberships_category.rb', line 171

def individual?
  category_type == 'Individual'
end

#membership_directory_titleObject



163
164
165
# File 'app/models/concerns/effective_memberships_category.rb', line 163

def membership_directory_title
  to_s
end

#membership_number_required?Boolean

Returns:

  • (Boolean)


179
180
181
# File 'app/models/concerns/effective_memberships_category.rb', line 179

def membership_number_required?
  true
end

#optional_applicant_review_wizard_stepsObject



203
204
205
# File 'app/models/concerns/effective_memberships_category.rb', line 203

def optional_applicant_review_wizard_steps
  applicant_review_wizard_steps - EffectiveMemberships.ApplicantReview.required_wizard_steps
end

#optional_applicant_wizard_stepsObject



195
196
197
# File 'app/models/concerns/effective_memberships_category.rb', line 195

def optional_applicant_wizard_steps
  applicant_wizard_steps - EffectiveMemberships.Applicant.required_wizard_steps
end

#optional_fee_payment_wizard_stepsObject



199
200
201
# File 'app/models/concerns/effective_memberships_category.rb', line 199

def optional_fee_payment_wizard_steps
  fee_payment_wizard_steps - EffectiveMemberships.FeePayment.required_wizard_steps
end

#organization?Boolean

Returns:

  • (Boolean)


175
176
177
# File 'app/models/concerns/effective_memberships_category.rb', line 175

def organization?
  category_type == 'Organization'
end

#prorated_fee(date:) ⇒ Object



183
184
185
# File 'app/models/concerns/effective_memberships_category.rb', line 183

def prorated_fee(date:)
  send("prorated_#{date.strftime('%b').downcase}").to_i
end

#stamp_feeObject



251
252
253
# File 'app/models/concerns/effective_memberships_category.rb', line 251

def stamp_fee
  0
end

#stamp_fee_qb_item_nameObject



255
256
257
# File 'app/models/concerns/effective_memberships_category.rb', line 255

def stamp_fee_qb_item_name
  qb_item_name
end

#stamp_fee_tax_exemptObject



259
260
261
# File 'app/models/concerns/effective_memberships_category.rb', line 259

def stamp_fee_tax_exempt
  tax_exempt
end

#to_sObject

Instance Methods



159
160
161
# File 'app/models/concerns/effective_memberships_category.rb', line 159

def to_s
  title.presence || 'New Membership Category'
end