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



236
237
238
# File 'app/models/concerns/effective_memberships_category.rb', line 236

def applicant_fee_qb_item_name
  'Applicant'
end

#applicant_fee_tax_exemptObject



240
241
242
# File 'app/models/concerns/effective_memberships_category.rb', line 240

def applicant_fee_tax_exempt
  tax_exempt
end

#applicant_reinstatement_wizard_stepsObject

Apply for Reinstatement



206
207
208
# File 'app/models/concerns/effective_memberships_category.rb', line 206

def applicant_reinstatement_wizard_steps
  [:reinstatement]
end

#applicant_review_wizard_stepsObject



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

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



201
202
203
# File 'app/models/concerns/effective_memberships_category.rb', line 201

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

#applicant_wizard_steps_collectionObject



218
219
220
221
222
223
224
225
# File 'app/models/concerns/effective_memberships_category.rb', line 218

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)


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

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

#can_apply_restricted_idsObject



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

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

#discount_fee(date:) ⇒ Object



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

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

#fee_payment_wizard_stepsObject



210
211
212
# File 'app/models/concerns/effective_memberships_category.rb', line 210

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

#fee_payment_wizard_steps_collectionObject



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

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)


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

def individual?
  category_type == 'Individual'
end

#membership_number_required?Boolean

Returns:

  • (Boolean)


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

def membership_number_required?
  true
end

#optional_applicant_review_wizard_stepsObject



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

def optional_applicant_review_wizard_steps
  applicant_review_wizard_steps - EffectiveMemberships.ApplicantReview.required_wizard_steps
end

#optional_applicant_wizard_stepsObject



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

def optional_applicant_wizard_steps
  applicant_wizard_steps - EffectiveMemberships.Applicant.required_wizard_steps
end

#optional_fee_payment_wizard_stepsObject



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

def optional_fee_payment_wizard_steps
  fee_payment_wizard_steps - EffectiveMemberships.FeePayment.required_wizard_steps
end

#organization?Boolean

Returns:

  • (Boolean)


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

def organization?
  category_type == 'Organization'
end

#prorated_fee(date:) ⇒ Object



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

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

#stamp_feeObject



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

def stamp_fee
  0
end

#stamp_fee_qb_item_nameObject



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

def stamp_fee_qb_item_name
  qb_item_name
end

#stamp_fee_tax_exemptObject



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

def stamp_fee_tax_exempt
  tax_exempt
end

#to_sObject

Instance Methods



156
157
158
# File 'app/models/concerns/effective_memberships_category.rb', line 156

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