effective_mailchimp 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49ad10cd9354cfacf479287b2c4c08fcd3bd4423e09214cb51e0c3b6ccfd16eb
|
4
|
+
data.tar.gz: 26616852a4c2fd9234b08653e4ffc0c0997888b100f4865be25ea27dea1af6f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06fe791199da318312aeca0e0c674f75b73e4d85147ac062f1504cea7cf80586ccac15e1da0eff8755c82627c908b62f90c4bc2bad3aea414047373dd592bf07
|
7
|
+
data.tar.gz: 2967fdadbe7296ca9b2d4f39c7f50c6506f44f335bed45379abda8e503b3d49b15655bd5091041e8f56c18a0508613967a1c40aaffa8ed4d6e583e77b4a5860e
|
@@ -34,7 +34,8 @@ module EffectiveMailchimpUser
|
|
34
34
|
}
|
35
35
|
|
36
36
|
# The user updated the form
|
37
|
-
after_commit(if: -> { mailchimp_member_update_required? }) do
|
37
|
+
after_commit(if: -> { mailchimp_member_update_required? }, unless: -> { EffectiveMailchimp.supressed? || @mailchimp_member_update_enqueued }) do
|
38
|
+
@mailchimp_member_update_enqueued = true
|
38
39
|
EffectiveMailchimpUpdateJob.perform_later(self) # This calls user.mailchimp_update! on the background
|
39
40
|
end
|
40
41
|
end
|
@@ -123,7 +124,8 @@ module EffectiveMailchimpUser
|
|
123
124
|
'CATEGORY': membership&.categories&.to_sentence,
|
124
125
|
'STATUS': membership&.statuses&.to_sentence,
|
125
126
|
'NUMBER': membership&.number,
|
126
|
-
'JOINED': membership&.joined_on&.strftime('%F')
|
127
|
+
'JOINED': membership&.joined_on&.strftime('%F'),
|
128
|
+
'FEESPAIDTO': mailchimp_membership_fees_paid_through_period()&.strftime('%F')
|
127
129
|
)
|
128
130
|
end
|
129
131
|
|
@@ -137,6 +139,29 @@ module EffectiveMailchimpUser
|
|
137
139
|
atts
|
138
140
|
end
|
139
141
|
|
142
|
+
# Returns the maximum fees_paid_through_period of the membership and any deferred membership_period fees
|
143
|
+
def mailchimp_membership_fees_paid_through_period
|
144
|
+
periods = []
|
145
|
+
|
146
|
+
# Find the fees_paid_through_period from any membership
|
147
|
+
if self.class.respond_to?(:effective_memberships_user?) && memberships.present?
|
148
|
+
membership = memberships.first() # Individual or organization membership
|
149
|
+
periods << membership&.fees_paid_through_period
|
150
|
+
end
|
151
|
+
|
152
|
+
# Find the fees_paid_through_period from any deferred membership fees
|
153
|
+
fees = if self.class.respond_to?(:effective_memberships_organization_user?) && organizations.present?
|
154
|
+
Effective::Fee.deferred.where(owner: [self, organizations])
|
155
|
+
else
|
156
|
+
Effective::Fee.deferred.where(owner: self)
|
157
|
+
end
|
158
|
+
|
159
|
+
periods += fees.select { |fee| fee.membership_period_fee? }.map(&:fees_paid_through_period)
|
160
|
+
|
161
|
+
# Return the maximum fees paid through period
|
162
|
+
periods.compact.max
|
163
|
+
end
|
164
|
+
|
140
165
|
def mailchimp_subscribed_lists
|
141
166
|
mailchimp_list_members.select(&:subscribed?).map(&:mailchimp_list)
|
142
167
|
end
|
data/lib/effective_mailchimp.rb
CHANGED
@@ -60,4 +60,20 @@ module EffectiveMailchimp
|
|
60
60
|
[ :mailchimp_user_form_action, mailchimp_list_members_attributes: [:id, :mailchimp_list_id, :subscribed, interests: []] ]
|
61
61
|
end
|
62
62
|
|
63
|
+
# Used to supress any background jobs during import processes
|
64
|
+
def self.supressed=(value)
|
65
|
+
Thread.current[:effective_mailchimp_supressed] = value
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.supressed(&block)
|
69
|
+
Thread.current[:effective_mailchimp_supressed] = true
|
70
|
+
value = yield
|
71
|
+
Thread.current[:effective_mailchimp_supressed] = nil
|
72
|
+
value
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.supressed?
|
76
|
+
Thread.current[:effective_mailchimp_supressed] == true
|
77
|
+
end
|
78
|
+
|
63
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_mailchimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|