effective_cpd 1.5.1 → 1.6.0

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: '007309633bd01dfa4ad2731f7c36f6d576c471c6de1f8ec21f355da5615a2b0d'
4
- data.tar.gz: f1a0b42227c58dea846ad8e288bccec8472ce05a747b790ef4a6b83ee8ab0539
3
+ metadata.gz: df0aa3e273f4a7e43776b241ff56606c511c4787b6c3377099ac9667d893d56a
4
+ data.tar.gz: 1ddbb75a7c986e35a1aa753a7ce8263a6cb2e5751b75c89b3bc6aa1a53a61e68
5
5
  SHA512:
6
- metadata.gz: 99d7615012e34a640bd5e3009559a431638880894f819910cbc3d6df770316c6e4329bebb2dfdd28cf44d7c39abf2f63f1682205232f5a8bea5f43c9e7b25c73
7
- data.tar.gz: 99e4617ac625fa40c15e60cbe535824be383edf62306ebd3337b01204c5a03d9f3b89c7c441045848f932fcdb1c21c564aa349c3334eddb2c2eee9c73a54631e
6
+ metadata.gz: 84ad353239bfccbc5b3f406b1c1abf9544ce0b4e0a674f953e7dbe1b1befad3131ed05ab198412e9963a074fa21558f1f94d673026e7192d1c2e4ec9a69e6ab4
7
+ data.tar.gz: 569f1f59c576c1170c94247a78803a217029234ebcb2ada6fa40f5ebb10671d664b1bfa73732c018d5170520b21eb792e58caebb07515b8584d48aac760c4db3
@@ -3,7 +3,6 @@
3
3
  # EffectiveCpdAudit
4
4
  #
5
5
  # Mark your owner model with effective_cpd_audit to get all the includes
6
-
7
6
  module EffectiveCpdAudit
8
7
  extend ActiveSupport::Concern
9
8
 
@@ -39,7 +38,6 @@ module EffectiveCpdAudit
39
38
  def chat_permissions
40
39
  ['Can send messages until closed', 'Always send messages', 'Never send messages']
41
40
  end
42
-
43
41
  end
44
42
 
45
43
  included do
@@ -65,15 +65,15 @@ module EffectiveCpdBulkAudit
65
65
  validates :audit_reviewers_count, numericality: { greater_than: 0 }
66
66
 
67
67
  validate(if: -> { cpd_user_scope.present? }) do
68
- self.errors.add(:cpd_user_class_name, "expecting an effective_cpd_user") unless cpd_user_scope.respond_to?(:effective_cpd_user?)
68
+ errors.add(:cpd_user_class_name, 'expecting an effective_cpd_user') unless cpd_user_scope.respond_to?(:effective_cpd_user?)
69
69
  end
70
70
 
71
71
  validate(if: -> { audits.present? && auditees_count.present? }) do
72
- self.errors.add(:audits, "can't be more than the number of auditees #{auditees_count}") if audits > auditees_count
72
+ errors.add(:audits, "can't be more than the number of auditees #{auditees_count}") if audits > auditees_count
73
73
  end
74
74
 
75
75
  validate(if: -> { audit_reviewers_per_audit.present? && audit_reviewers_count.present? }) do
76
- self.errors.add(:audit_reviewers_per_audit, "can't be more than the number of audit reviewers #{audit_reviewers_count}") if audit_reviewers_per_audit > audit_reviewers_count
76
+ errors.add(:audit_reviewers_per_audit, "can't be more than the number of audit reviewers #{audit_reviewers_count}") if audit_reviewers_per_audit > audit_reviewers_count
77
77
  end
78
78
 
79
79
  after_commit(on: :create) { create_bulk_audit_job! }
@@ -154,5 +154,4 @@ module EffectiveCpdBulkAudit
154
154
 
155
155
  @reviewers[@reviewers_index]
156
156
  end
157
-
158
157
  end
@@ -3,7 +3,6 @@
3
3
  # EffectiveCpdStatement
4
4
  #
5
5
  # Mark your owner model with effective_cpd_statement to get all the includes
6
-
7
6
  module EffectiveCpdStatement
8
7
  extend ActiveSupport::Concern
9
8
 
@@ -14,7 +13,9 @@ module EffectiveCpdStatement
14
13
  end
15
14
 
16
15
  module ClassMethods
17
- def effective_cpd_statement?; true; end
16
+ def effective_cpd_statement?
17
+ true
18
+ end
18
19
  end
19
20
 
20
21
  included do
@@ -81,8 +82,8 @@ module EffectiveCpdStatement
81
82
  end
82
83
 
83
84
  validate(if: -> { completed? && target_score_required_to_submit? }) do
84
- min = target_score() || 0.0
85
- self.errors.add(:score, "must be #{min} or greater to submit a statement") if score < min
85
+ min = target_score || 0.0
86
+ errors.add(:score, "must be #{min} or greater to submit a statement") if score < min
86
87
  end
87
88
 
88
89
  with_options(if: -> { current_step == :agreements }) do
@@ -93,6 +94,8 @@ module EffectiveCpdStatement
93
94
  with_options(if: -> { current_step == :submit}) do
94
95
  validates :confirm_readonly, acceptance: true
95
96
  end
97
+
98
+ validates :cpd_cycle_id, uniqueness: { scope: [:user_type, :user_id] }, if: -> { new_record? && cpd_cycle && user }
96
99
  end
97
100
 
98
101
  def to_s
@@ -148,5 +151,4 @@ module EffectiveCpdStatement
148
151
  cpd_statement_activities.each { |activity| scores[activity.cpd_category_id] += activity.score.to_d }
149
152
  end
150
153
  end
151
-
152
154
  end
data/config/routes.rb CHANGED
@@ -38,7 +38,7 @@ EffectiveCpd::Engine.routes.draw do
38
38
  resources :cpd_special_rules, except: [:show]
39
39
  resources :cpd_targets, except: [:show]
40
40
 
41
- resources :cpd_statements, only: [:index, :show] do
41
+ resources :cpd_statements, only: [:index, :show, :destroy] do
42
42
  post :unsubmit, on: :member
43
43
  end
44
44
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '1.5.1'
2
+ VERSION = '1.6.0'
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: 1.5.1
4
+ version: 1.6.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: 2023-03-31 00:00:00.000000000 Z
11
+ date: 2023-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails