effective_cpd 0.1.15 → 0.1.19

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: 168b4998cd7418e64ce7d62bcba5b09c4dc0bfaf65ad54c1c999d63dd35027c5
4
- data.tar.gz: 6388aa96a64ea432603d30c52e5dcd481d8df997164be6d9e2f9c3c98116e8d4
3
+ metadata.gz: fe768cdc3715d62c09b0c829d6823db4ce8587fd603244dceb4243976006bb02
4
+ data.tar.gz: 0540bd3c67a6df4c5fbc2d612ccbc67f834ff46d96a605c2200ac8866f21dfbd
5
5
  SHA512:
6
- metadata.gz: 8bf76efd6c2501340bc77c922f5125378fc9d60e5d5fd299511e1bac18bf23e4c99e2aac397b0094d7f01de1af434bf6fa71e4dba87d54c2cae597bfc1b9e772
7
- data.tar.gz: dc255a5bbbfe0a76bd999af4cb6316355e3afc6d6b4fc8cdd33b2b7b020fa28cb4ec971acdaf012c3f2368cd2068fdc76f1fea6725773b12cf2192dadef63235
6
+ metadata.gz: 00701f9319d26d59b192bf831d7072441661798a2202ba728cdf474b798fc9cfc5e3a013b5b725a45d58f6861192d48684acb6b3aec7508a7787d2e3608433c4
7
+ data.tar.gz: a363248b7decc2a56fcc86d29748c3c29b97fe6ea256406a10f5a41af69064301158871851e8b3dbe2227e3bd40a8009e95a8f16601a4da8f629027d53e65470
@@ -3,6 +3,7 @@ module Effective
3
3
  before_action(:authenticate_user!) if defined?(Devise)
4
4
 
5
5
  include Effective::WizardController
6
+ include EffectiveCpdHelper
6
7
 
7
8
  resource_scope do
8
9
  cycle = Effective::CpdCycle.find(params[:cpd_cycle_id])
@@ -18,11 +19,7 @@ module Effective
18
19
  cycle = Effective::CpdCycle.find(params[:cpd_cycle_id])
19
20
  existing = Effective::CpdStatement.where(cpd_cycle: cycle, user: current_user).where.not(id: resource).first
20
21
 
21
- if existing&.completed?
22
- flash[:danger] = "You have already completed a statement for this #{cpd_cycle_label}."
23
- redirect_to(root_path)
24
- elsif existing.present?
25
- flash[:success] = "You have been redirected to the #{resource_wizard_step_title(existing, existing.next_step)} step."
22
+ if existing.present?
26
23
  redirect_to effective_cpd.cpd_cycle_cpd_statement_build_path(existing.cpd_cycle, existing, existing.next_step)
27
24
  end
28
25
  end
@@ -30,6 +30,16 @@ module Admin
30
30
  end
31
31
  end
32
32
  end.join.html_safe
33
+ end.search do |collection, term, column, sql_column|
34
+ user_klass = Effective::CpdAudit.first.user&.class
35
+
36
+ if user_klass.present?
37
+ users = Effective::Resource.new(user_klass).search_any(term)
38
+ cpd_audit_reviews = Effective::CpdAuditReview.where(user_id: users)
39
+ collection.where(id: cpd_audit_reviews.select('cpd_audit_id AS id'))
40
+ else
41
+ collection.where(id: nil)
42
+ end
33
43
  end
34
44
 
35
45
  col :notification_date, label: 'Date of Notification'
@@ -117,6 +117,8 @@ module Effective
117
117
  private
118
118
 
119
119
  def eval_equation(amount: nil, amount2: nil)
120
+ return 0 if formula.blank?
121
+
120
122
  equation = formula.gsub('amount2', amount2.to_s).gsub('amount', amount.to_s)
121
123
  eval(equation).round.to_i
122
124
  end
@@ -161,7 +161,10 @@ module Effective
161
161
  description: existing.description,
162
162
  )
163
163
 
164
- existing.files.each { |file| activity.files.attach(file.blob) }
164
+ existing.files.each do |file|
165
+ blob = EffectiveResources.clone_blob(file.blob)
166
+ activity.files.attach(blob)
167
+ end
165
168
 
166
169
  activity.assign_attributes(
167
170
  carry_over: existing.carry_forward,
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '0.1.15'
2
+ VERSION = '0.1.19'
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.1.15
4
+ version: 0.1.19
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: 2021-10-07 00:00:00.000000000 Z
11
+ date: 2021-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails