effective_memberships 0.17.8 → 0.17.9

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: 02b881930550198b6c2e18381683543910d16534b7766768661eb4f91cf96214
4
- data.tar.gz: e30e3b80c39e484178561cd7aba32e4157c735d831afb80ca16758ca748c9479
3
+ metadata.gz: 7a7ab7d95194d5d7c49af9f4d8297b4a9f927f9d4a2d97ea2f18ead660488685
4
+ data.tar.gz: 7412d96bc6f4b1c7329a3fa2b4998e0045d921f1deec09886f024f42b868afc7
5
5
  SHA512:
6
- metadata.gz: 95040d97dfc5aadc8816a2fb6cc2111336306df360a05622386a9db87848a12921449970c9f8f63b5a4ffdd5e54b6a5cced0b7c4cef59e188c850f6ded76dc59
7
- data.tar.gz: 15fc30fe1419f2c9443e19d07620b63180195995472b5fb86040ac4d1e46eadc906ff07b70fb3356b1c42ace9870e523c3afaf0cbd62b41724208e22e1b1c3c4
6
+ metadata.gz: 6aeaa23fda513f0b707252be4009fa6b25c19a8ee9f7ead8761a15893fa5b56a2b1ddba20da408e42f5d8c7759dc1b53c9faba19b20eecac28b5dfdf863c8703
7
+ data.tar.gz: d2abd9350b5b98b43db54214b9cdf4a8fdc40858a66a4ea8f0ad301870326d16892287ad5ae1ac4a8dda70db2545e0d4ed12092e2bf265b3ae249137323bc311
@@ -192,7 +192,7 @@ module EffectiveMembershipsApplicant
192
192
 
193
193
  # effective_reports
194
194
  def reportable_scopes
195
- { draft: nil, submitted: nil, in_progress: nil, done: nil }
195
+ { draft: nil, submitted: nil, missing_info: nil, completed: nil, reviewed: nil, declined: nil, approved: nil, in_progress: nil, done: nil }
196
196
  end
197
197
 
198
198
  scope :deep, -> { includes(:user, :organization, :category, :from_category, :from_status, :orders) }
@@ -202,7 +202,6 @@ module EffectiveMembershipsApplicant
202
202
  scope :done, -> { where(status: [:approved, :declined]) }
203
203
 
204
204
  scope :not_draft, -> { where.not(status: :draft) }
205
-
206
205
  scope :reviewable, -> { where.not(status: [:draft, :submitted, :declined, :approved]) }
207
206
 
208
207
  scope :for, -> (user) {
@@ -29,6 +29,7 @@ module EffectiveMembershipsApplicantReview
29
29
 
30
30
  included do
31
31
  log_changes(to: :applicant) if respond_to?(:log_changes)
32
+ acts_as_reportable if respond_to?(:acts_as_reportable)
32
33
 
33
34
  acts_as_tokened
34
35
 
@@ -59,6 +60,15 @@ module EffectiveMembershipsApplicantReview
59
60
  timestamps
60
61
  end
61
62
 
63
+ # effective_reports
64
+ def reportable_scopes
65
+ { in_progress: nil, done: nil }
66
+ end
67
+
68
+ def reportable_email
69
+ reviewer.try(:email)
70
+ end
71
+
62
72
  scope :deep, -> { includes(:reviewer, applicant: [:user, :applicant_reviews]) }
63
73
 
64
74
  scope :for, -> (user) {
@@ -11,6 +11,7 @@ module Effective
11
11
  )
12
12
 
13
13
  log_changes(to: :applicant) if respond_to?(:log_changes)
14
+ acts_as_reportable if respond_to?(:acts_as_reportable)
14
15
 
15
16
  belongs_to :applicant, polymorphic: true, optional: true
16
17
 
@@ -52,6 +53,20 @@ module Effective
52
53
  timestamps
53
54
  end
54
55
 
56
+ # effective_reports
57
+ def reportable_scopes
58
+ { in_progress: nil, done: nil, expired: nil }
59
+ end
60
+
61
+ scope :in_progress, -> { with_submitted_applicants.where(status: :submitted) }
62
+ scope :done, -> { where(status: :completed) }
63
+
64
+ scope :expired, -> { where(status: :submitted).where.not(with_submitted_applicants) }
65
+
66
+ scope :with_submitted_applicants, -> {
67
+ where(applicant_id: EffectiveMemberships.Applicant.submitted)
68
+ }
69
+
55
70
  scope :deep, -> { all }
56
71
 
57
72
  # All step validations
@@ -11,6 +11,7 @@ module Effective
11
11
  has_many :membership_statuses, -> { order(:id) }, inverse_of: :membership, dependent: :delete_all
12
12
  accepts_nested_attributes_for :membership_statuses
13
13
 
14
+ acts_as_reportable if respond_to?(:acts_as_reportable)
14
15
  log_changes(to: :owner) if respond_to?(:log_changes)
15
16
 
16
17
  effective_resource do
@@ -35,7 +36,23 @@ module Effective
35
36
  scope :deep, -> { includes(:owner, membership_categories: :category, membership_statuses: :status) }
36
37
  scope :sorted, -> { order('lower(owner_name)') }
37
38
 
39
+ # effective_reports
40
+ def reportable_scopes
41
+ {
42
+ with_category: :string,
43
+ with_status: :string,
44
+ joined_before: :date,
45
+ joined_after: :date,
46
+ with_paid_fees_through: :date,
47
+ with_unpaid_fees_through: :date,
48
+ in_good_standing: nil,
49
+ not_in_good_standing: nil
50
+ }
51
+ end
52
+
38
53
  scope :with_status, -> (statuses) {
54
+ statuses = Resource.new(EffectiveMemberships.Status).search_any(statuses) if statuses.kind_of?(String)
55
+
39
56
  raise('expected an EffectiveMemberships.Status') unless statuses.class.respond_to?(:effective_memberships_status?) || Array(statuses).all? { |status| status.kind_of?(EffectiveMemberships.Status) }
40
57
  where(id: MembershipStatus.where(status_id: statuses).select(:membership_id))
41
58
  }
@@ -46,6 +63,8 @@ module Effective
46
63
  }
47
64
 
48
65
  scope :with_category, -> (categories) {
66
+ categories = Resource.new(EffectiveMemberships.Category).search_any(categories) if categories.kind_of?(String)
67
+
49
68
  raise('expected an EffectiveMemberships.Category') unless categories.class.respond_to?(:effective_memberships_category?) || Array(categories).all? { |cat| cat.kind_of?(EffectiveMemberships.Category) }
50
69
  where(id: MembershipCategory.where(category_id: categories).select(:membership_id))
51
70
  }
@@ -2,6 +2,8 @@ module Effective
2
2
  class MembershipHistory < ActiveRecord::Base
3
3
  belongs_to :owner, polymorphic: true
4
4
 
5
+ acts_as_reportable if respond_to?(:acts_as_reportable)
6
+
5
7
  effective_resource do
6
8
  start_on :date
7
9
  end_on :date
@@ -13,6 +15,9 @@ module Effective
13
15
  categories :text
14
16
  category_ids :text
15
17
 
18
+ statuses :text
19
+ status_ids :text
20
+
16
21
  notes :text
17
22
 
18
23
  timestamps
@@ -27,9 +32,15 @@ module Effective
27
32
  serialize :statuses, Array
28
33
  serialize :status_ids, Array
29
34
 
35
+ # effective_reports
36
+ def reportable_scopes
37
+ { removed: nil, not_removed: nil }
38
+ end
39
+
30
40
  scope :deep, -> { includes(:owner) }
31
41
  scope :sorted, -> { order(:start_on).order(:id) }
32
42
 
43
+ scope :not_removed, -> { where(removed: false) }
33
44
  scope :removed, -> { where(removed: true) }
34
45
 
35
46
  validates :owner, presence: true
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.17.8'
2
+ VERSION = '0.17.9'
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.17.8
4
+ version: 0.17.9
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: 2023-05-16 00:00:00.000000000 Z
11
+ date: 2023-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails