effective_cpd 0.6.4 → 0.6.6

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: b79ba96a9dae1e17abff7271ca62da9cfec647a361e6782c2c0a7dce76c6cef3
4
- data.tar.gz: 6abd37b65ff6587abfb8c954d22809bfe8df5fdafea5326fc961a8aec5cd9efd
3
+ metadata.gz: f119fa3686ef62e2b4b785b32f9da5775bb1d809564189cd294a1b018dc3f749
4
+ data.tar.gz: 34601ca091deac96e428bebb3d013ea504ec0047413af9baa047fc3199a52201
5
5
  SHA512:
6
- metadata.gz: 0c10181c5acb5d2df06f0812e83cd06b35890e52a719572003ff85680544fe2cc888dc825293704b7ce339fb34cb53b8a138e8374c379331d023c7b62f473515
7
- data.tar.gz: a9836a26dbdeb3928c3654b2b469d7f22529384829a8b9bec3925da0d3f87cdea5dd35d0885de3d72f6c3f8ed76f31ebb26ca0c0b5be52cfa0212112d6c8e1d4
6
+ metadata.gz: eb27171d3f177bc81cb3831d13902f61402049a8e07889c9e476fa38153007ed734baaa990d7376bd6c318d41de6d39c12588156898165453dc9775477e3dc88
7
+ data.tar.gz: e96c06221841c0f35f81459ce7664dd002dfd53d02f30feb4a25b9ebe874f70208736eb2263ee6757cf5a89ca9990cacc8dd4184a485227407e6bad8a91b4521
@@ -19,6 +19,7 @@ module EffectiveCpdStatement
19
19
 
20
20
  included do
21
21
  acts_as_tokened
22
+ acts_as_reportable if respond_to?(:acts_as_reportable)
22
23
 
23
24
  acts_as_wizard(
24
25
  start: 'Start',
@@ -68,6 +69,11 @@ module EffectiveCpdStatement
68
69
  scope :draft, -> { where(submitted_at: nil) }
69
70
  scope :completed, -> { where.not(submitted_at: nil) }
70
71
 
72
+ # effective_reports
73
+ def reportable_scopes
74
+ { draft: nil, completed: nil }
75
+ end
76
+
71
77
  before_validation(if: -> { new_record? }) do
72
78
  self.user ||= current_user
73
79
  self.score ||= 0
@@ -23,6 +23,7 @@ module Effective
23
23
 
24
24
  acts_as_email_form
25
25
  acts_as_tokened
26
+ acts_as_reportable if respond_to?(:acts_as_reportable)
26
27
 
27
28
  COMPLETED_STATES = [:exemption_granted, :closed]
28
29
 
@@ -120,6 +121,11 @@ module Effective
120
121
  scope :waiting_on_auditee, -> { where(status: WAITING_ON_AUDITEE_STATES) }
121
122
  scope :waiting_on_reviewers, -> { where(status: WAITING_ON_REVIEWERS_STATES) }
122
123
 
124
+ # effective_reports
125
+ def reportable_scopes
126
+ { draft: nil, available: nil, completed: nil, waiting_on_admin: nil, waiting_on_auditee: nil, waiting_on_reviewers: nil }
127
+ end
128
+
123
129
  before_validation(if: -> { new_record? }) do
124
130
  self.notification_date ||= Time.zone.now
125
131
  self.due_date ||= deadline_to_submit()
@@ -16,6 +16,7 @@ module Effective
16
16
 
17
17
  acts_as_email_form
18
18
  acts_as_tokened
19
+ acts_as_reportable if respond_to?(:acts_as_reportable)
19
20
 
20
21
  acts_as_wizard(
21
22
  start: 'Start',
@@ -72,6 +73,11 @@ module Effective
72
73
  scope :available, -> { where(submitted_at: nil) }
73
74
  scope :completed, -> { where.not(submitted_at: nil) }
74
75
 
76
+ # effective_reports
77
+ def reportable_scopes
78
+ { available: nil, completed: nil }
79
+ end
80
+
75
81
  before_validation(if: -> { new_record? }) do
76
82
  self.cpd_audit_level ||= cpd_audit&.cpd_audit_level
77
83
  self.due_date ||= deadline_to_review()
@@ -166,6 +166,8 @@ module Effective
166
166
  )
167
167
 
168
168
  existing.files.each do |file|
169
+ next if activity.files.any? { |f| file.filename.to_s == f.filename.to_s }
170
+
169
171
  blob = EffectiveResources.clone_blob(file.blob)
170
172
  activity.files.attach(blob)
171
173
  end
@@ -16,9 +16,8 @@ module Effective
16
16
 
17
17
  has_many_attached :files
18
18
 
19
- if respond_to?(:log_changes)
20
- log_changes(to: :cpd_statement)
21
- end
19
+ acts_as_reportable if respond_to?(:acts_as_reportable)
20
+ log_changes(to: :cpd_statement) if respond_to?(:log_changes)
22
21
 
23
22
  effective_resource do
24
23
  amount :decimal
@@ -44,6 +43,11 @@ module Effective
44
43
  scope :draft, -> { where(cpd_statement_id: EffectiveCpd.CpdStatement.draft) }
45
44
  scope :completed, -> { where(cpd_statement_id: EffectiveCpd.CpdStatement.completed) }
46
45
 
46
+ # effective_reports
47
+ def reportable_scopes
48
+ { draft: nil, completed: nil }
49
+ end
50
+
47
51
  validates :original, presence: true, if: -> { (carry_over || 0) > 0 }
48
52
  validates :description, presence: true
49
53
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '0.6.4'
2
+ VERSION = '0.6.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_cpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.6
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-11-28 00:00:00.000000000 Z
11
+ date: 2023-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails