effective_memberships 0.8.3 → 0.8.5

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: f3936f6e8acaea0e3aea19acfb6ab2919eed75cf533997d7d3ceb9423acb67c1
4
- data.tar.gz: d23bdf6c67f07b6d0558a4f03e40237b6a93a2a55603e9d534d4a9d63464f182
3
+ metadata.gz: 16aad89a828aaadb74afcdcfa17f49674b3ad9a44fb387c61c173feb875cf16b
4
+ data.tar.gz: dff6f1dd922e27485e915337f3646aa94de945686f4a3310a596c59f625d1ae2
5
5
  SHA512:
6
- metadata.gz: 9245f8060285f526b024a616fe0125460fe59567140fd106c6f657f1504b9e5385157ef24f3e3ca5f1ca27ac78280929ee9ea87021ef1ad202bfd03d39d1d526
7
- data.tar.gz: 76586e73e7f04ff55343be3012169d5afb6b8fe3265279b46aab16c9f32f6798b7582282fe63bef73cc37278376538ac004b3a21691b4a0da932270786e22664
6
+ metadata.gz: 80d38ebb32070e8cf15314d1e51d35f37f54482c548d2e4d9e2ae7125e93148b3bffbfac913ba4069fdf172b37a03ed75a8764e5799ba6d4ae2719164ad16d8b
7
+ data.tar.gz: 7a3637bf9aeb9a36097f19cafd6b03b61019c60b373e10e68f182cb351175c44e58a6fa439d0c101ed8cf5c212f088121b524f0a28608b5c3d2588253ed9078d
@@ -8,15 +8,21 @@ module Admin
8
8
  col :owner_id, visible: false
9
9
  col :owner_type, visible: false
10
10
 
11
- val :owner
12
- col :categories, search: EffectiveMemberships.Category.sorted.map(&:to_s)
13
- col :statuses, search: EffectiveMemberships.Status.sorted.map(&:to_s)
11
+ col :owner
12
+
13
+ col(:categories, search: EffectiveMemberships.Category.sorted, sql_column: true, sort: false).search do |collection, term|
14
+ collection.with_category(EffectiveMemberships.Category.find(term))
15
+ end
16
+
17
+ col(:statuses, search: EffectiveMemberships.Status.sorted, sql_column: true, sort: false).search do |collection, term|
18
+ collection.with_status(EffectiveMemberships.Status.find(term))
19
+ end
14
20
 
15
21
  col :number
16
22
  col :number_as_integer, visible: false
17
23
 
18
24
  col :joined_on
19
- col :registration_on
25
+ col :registration_on, label: 'Last changed'
20
26
 
21
27
  col :fees_paid_period, visible: false, label: 'Fees Paid'
22
28
  col :fees_paid_through_period, label: 'Fees Paid Through'
@@ -157,6 +157,10 @@ module EffectiveMembershipsCategory
157
157
  title.presence || 'New Membership Category'
158
158
  end
159
159
 
160
+ def membership_directory_title
161
+ to_s
162
+ end
163
+
160
164
  def can_apply?
161
165
  can_apply_new? || can_apply_existing? || can_apply_restricted?
162
166
  end
@@ -342,7 +342,7 @@ module EffectiveMembershipsOwner
342
342
 
343
343
  # Check that there is a membership history row if the registered date is unique
344
344
  if membership.joined_on != membership.registration_on && membership_histories.none? { |mh| mh.start_on == membership.registration_on }
345
- errors << "The registered date #{membership.registration_on.strftime('%F')} is missing a history with this date. Please create a history with a start date of #{membership.registration_on.strftime('%F')} or update the registered date above."
345
+ errors << "The last changed date #{membership.registration_on.strftime('%F')} is missing a history with this date. Please create a history with a start date of #{membership.registration_on.strftime('%F')} or update the last changed date above."
346
346
  end
347
347
 
348
348
  # Check numbers
@@ -99,6 +99,7 @@ module EffectiveMembershipsRegistrar
99
99
  end
100
100
 
101
101
  changed = membership.membership_categories.any? { |mc| mc.new_record? || mc.marked_for_destruction? }
102
+ changed ||= membership.membership_statuses.any? { |ms| ms.new_record? || ms.marked_for_destruction? }
102
103
 
103
104
  if changed
104
105
  membership.registration_on = date # Always new registration_on
@@ -60,6 +60,10 @@ module EffectiveMembershipsStatus
60
60
  title.presence || 'New Membership Status'
61
61
  end
62
62
 
63
+ def membership_directory_title
64
+ to_s
65
+ end
66
+
63
67
  def individual?
64
68
  status_type == 'Individual'
65
69
  end
@@ -27,7 +27,7 @@ module Effective
27
27
  timestamps
28
28
  end
29
29
 
30
- scope :deep, -> { includes(:owner, membership_categories: :category) }
30
+ scope :deep, -> { includes(:owner, membership_categories: :category, membership_statuses: :status) }
31
31
  scope :sorted, -> { order(:id) }
32
32
 
33
33
  scope :with_status, -> (statuses) {
@@ -116,7 +116,7 @@ module Effective
116
116
  'member',
117
117
  ("##{number_was}" if number_was.present?),
118
118
  "who joined #{joined_on&.strftime('%F') || '-'}",
119
- ("and last registered #{registration_on.strftime('%F')}" if registration_on > joined_on)
119
+ ("and last changed on #{registration_on.strftime('%F')}" if registration_on > joined_on)
120
120
  ].compact.join(' ')
121
121
 
122
122
  (summary + '.').html_safe
@@ -14,7 +14,7 @@
14
14
 
15
15
  = f.show_if :current_action, true do
16
16
  = f.date_field :joined_on, label: 'Joined', hint: 'When the member first received any membership category'
17
- = f.date_field :registration_on, label: 'Registered', hint: 'When the membership category last changed'
17
+ = f.date_field :registration_on, label: 'Last changed', hint: 'When the membership category or status last changed'
18
18
  = f.text_field :number, hint: 'The membership number. Must be unique.'
19
19
 
20
20
  - registrar = EffectiveMemberships.Registrar
@@ -1,4 +1,7 @@
1
1
  = card do
2
2
  %h6= owner
3
- %p= membership.categories.to_sentence
4
- %p= membership.statuses.to_sentence
3
+ %p= membership.categories.map(&:membership_directory_title).to_sentence
4
+ %p= membership.statuses.map(&:membership_directory_title).to_sentence
5
+
6
+ - if owner.try(:email).present?
7
+ %p= reveal_mail_to(owner.email)
@@ -28,7 +28,7 @@
28
28
  %p You joined on #{membership.joined_on.strftime('%F')} and have not been assigned a membership number.
29
29
 
30
30
  - if membership.registration_on > membership.joined_on
31
- %p You last changed categories on #{membership.registration_on.strftime('%F')}.
31
+ %p Your last category or status change was on #{membership.registration_on.strftime('%F')}.
32
32
 
33
33
  - if membership.not_in_good_standing?
34
34
  %p Your membership is Not In Good Standing because of unpurchased fees or dues. Please purchase these dues or contact us.
@@ -5,7 +5,7 @@
5
5
  %td= membership.joined_on.strftime('%F')
6
6
 
7
7
  %tr
8
- %th Registered
8
+ %th Last Changed
9
9
  %td= membership.registration_on.strftime('%F')
10
10
 
11
11
  - if membership.categories.length == 0
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.8.3'
2
+ VERSION = '0.8.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_memberships
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.5
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: 2022-10-31 00:00:00.000000000 Z
11
+ date: 2022-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails