effective_memberships 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0100c4901a84ee663094b0c2875ea528d7345f68f99659e09f5d6daf973ce54c
|
4
|
+
data.tar.gz: 17df43487cab37459c5ea999396724f556b74f05e7ed853eaf55bfb3f0e3b279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e06ad2ca2dc09ec15d83a7d413d6cd07663c198f16b6ea8716c0e669dd1671d6141396cf2ce0d903cf47b0c22a2bccf710764981595ee55d43a624bbc91be54
|
7
|
+
data.tar.gz: c0c489c0dfc6deda6be5fdb9ebb70f8647c7afb41a10d8905d59e78b7dcf1ad03d3bc46733169b1089d28d0a767f4c46d8bbc6a26f2459602d88466c93a53426
|
@@ -264,7 +264,7 @@ module EffectiveMembershipsOwner
|
|
264
264
|
|
265
265
|
# Only continue if there is a late renewal fee for the same period
|
266
266
|
renewal_fee = fees.find { |fee| fee.fee_type == 'Renewal' && fee.period == period && fee.category_id == category.id && fee.category_type == category.class.name }
|
267
|
-
return
|
267
|
+
return if fee.blank? && (renewal_fee.blank? || renewal_fee.late? == false)
|
268
268
|
|
269
269
|
# Build the late fee
|
270
270
|
fee ||= fees.build()
|
@@ -292,7 +292,7 @@ module EffectiveMembershipsOwner
|
|
292
292
|
# Assign in bad standing
|
293
293
|
if membership.bad_standing_admin?
|
294
294
|
# Nothing to do
|
295
|
-
elsif bad_standing_fees.present?
|
295
|
+
elsif bad_standing_fees.present? && membership.categories.any?(&:create_bad_standing?)
|
296
296
|
membership.bad_standing = true
|
297
297
|
membership.bad_standing_reason = 'Unpaid Fees'
|
298
298
|
else
|
@@ -401,7 +401,7 @@ module EffectiveMembershipsRegistrar
|
|
401
401
|
GC.start
|
402
402
|
|
403
403
|
# Update Membership Status - Assign In Bad Standing
|
404
|
-
memberships.find_each { |membership|
|
404
|
+
memberships.find_each { |membership| create_bad_standing!(membership, period: period) }
|
405
405
|
GC.start
|
406
406
|
|
407
407
|
true
|
@@ -416,7 +416,7 @@ module EffectiveMembershipsRegistrar
|
|
416
416
|
raise("expected build_renewal_fee to return a fee for period #{period}") unless fee.kind_of?(Effective::Fee)
|
417
417
|
next if fee.purchased?
|
418
418
|
|
419
|
-
puts("Created renewal fee for #{membership.owner}") if fee.new_record? &&
|
419
|
+
puts("Created renewal fee for #{membership.owner}") if fee.new_record? && debug?
|
420
420
|
|
421
421
|
fee.save!
|
422
422
|
end
|
@@ -426,10 +426,18 @@ module EffectiveMembershipsRegistrar
|
|
426
426
|
membership.categories.select(&:create_late_fees?).map do |category|
|
427
427
|
fee = membership.owner.build_late_fee(category: category, period: period)
|
428
428
|
next if fee.blank? || fee.purchased?
|
429
|
+
|
430
|
+
puts("Created late fee for #{membership.owner}") if fee.new_record? && debug?
|
431
|
+
|
429
432
|
fee.save!
|
430
433
|
end
|
431
434
|
end
|
432
435
|
|
436
|
+
def create_bad_standing!(membership, period:)
|
437
|
+
return unless membership.categories.any?(&:create_bad_standing?)
|
438
|
+
update_membership_status!(membership, period: period)
|
439
|
+
end
|
440
|
+
|
433
441
|
def update_membership_status!(membership, period: nil)
|
434
442
|
membership.owner.update_membership_status!
|
435
443
|
end
|
@@ -442,6 +450,10 @@ module EffectiveMembershipsRegistrar
|
|
442
450
|
|
443
451
|
protected
|
444
452
|
|
453
|
+
def debug?
|
454
|
+
false
|
455
|
+
end
|
456
|
+
|
445
457
|
def add_member_role(owner)
|
446
458
|
owner.add_role(:member)
|
447
459
|
|