Module: EffectiveMembershipsFeePayment
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/effective_memberships_fee_payment.rb
Overview
EffectiveMembershipsFeePayment
Mark your model with effective_memberships_fee_payment to get all the includes
Defined Under Namespace
Modules: Base, ClassMethods
Instance Method Summary
collapse
Instance Method Details
#build_organization(params = {}) ⇒ Object
212
213
214
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 212
def build_organization(params = {})
self.organization = EffectiveMemberships.Organization.new(params)
end
|
#cpd_completed_cpd_cycles ⇒ Object
256
257
258
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 256
def cpd_completed_cpd_cycles
cpd_required_cpd_cycles.select { |cpd_cycle| user&.cpd_statement(cpd_cycle: cpd_cycle)&.completed? }
end
|
#cpd_required_cpd_cycles ⇒ Object
247
248
249
250
251
252
253
254
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 247
def cpd_required_cpd_cycles
date = submitted_at || Time.zone.now
[
(EffectiveCpd.previous_cpd_cycle(date: date) if cpd_requirement.to_s.include?('previous')),
(EffectiveCpd.current_cpd_cycle(date: date) if cpd_requirement.to_s.include?('current'))
].compact
end
|
#cpd_requirement ⇒ Object
243
244
245
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 243
def cpd_requirement
(category&.fee_payment_cpd_step_requirement.presence || EffectiveMemberships.Category.cpd_step_requirements.first)
end
|
#cpd_uncompleted_cpd_cycles ⇒ Object
260
261
262
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 260
def cpd_uncompleted_cpd_cycles
cpd_required_cpd_cycles.reject { |cpd_cycle| user&.cpd_statement(cpd_cycle: cpd_cycle)&.completed? }
end
|
#done? ⇒ Boolean
229
230
231
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 229
def done?
submitted?
end
|
#in_progress? ⇒ Boolean
225
226
227
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 225
def in_progress?
draft?
end
|
#owner ⇒ Object
204
205
206
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 204
def owner
organization || user
end
|
#owner_symbol ⇒ Object
208
209
210
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 208
def owner_symbol
organization? ? :organization : :user
end
|
#reset! ⇒ Object
237
238
239
240
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 237
def reset!
assign_attributes(wizard_steps: wizard_steps.slice(:start))
save!
end
|
#select! ⇒ Object
233
234
235
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 233
def select!
reset!
end
|
#to_s ⇒ Object
200
201
202
|
# File 'app/models/concerns/effective_memberships_fee_payment.rb', line 200
def to_s
'Fee Payment'
end
|