renalware-core 2.0.116 → 2.0.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cb27774d18c6f2491947cf9a178521fc8516459efa8f1d9dd960a1b929cf7f2
4
- data.tar.gz: 58de5e25e25319887f6727b360d666bffdb24ebdb6473db96be5079543b418a5
3
+ metadata.gz: 90a6805bb8cf3b390ced2cb486b99fcc5ffe4d422a191f93cd0db17d7ecd48d5
4
+ data.tar.gz: 8f1f5c571e429f2733916bc467bb4795c644bab6499c8d33827265847a3c06c9
5
5
  SHA512:
6
- metadata.gz: cbc216e56c23b9f819a005591c03fe13c391bc5dbe9472b8efae867b297f4605c801703caee6003228942f816019648381893c1ba9f32aa49ad5ff272433affe
7
- data.tar.gz: 755ea6f7935778b76627bd61047aaf798ebb0bcce1369dbf94b663e95d47251972f732cd04ee9135fd1cac77d3090c5a40e398f6deab38a4ffbbf977cfa6a51b
6
+ metadata.gz: 01a912fcb03003db4ab86ce2561dc66370548a0f37e00e90f97e2db932a66723f69d7db0d62c11ff1e2ef5cdd768dbd9d262894a7dcd7e504b13c271ea86e0e3
7
+ data.tar.gz: b3b0b0b66293404ff97e20c05bbc79598e999cdc5aa35ebc44eda9c902ba2adf465f76b20ea03932b4c392711b2aa4b82bf8bd69814c96884429f66184a169c6
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_dependency "renalware/admin"
4
- require "ap"
5
4
 
6
5
  module Renalware
7
6
  module Feeds
@@ -3,51 +3,78 @@
3
3
  module Renalware
4
4
  module Problems
5
5
  class NotesController < BaseController
6
- before_action :load_patient
7
-
8
6
  def index
9
- load_problem
10
7
  render_index
11
8
  end
12
9
 
13
10
  def new
14
- load_problem
15
- note = @problem.notes.new
16
- render_form(note, url: patient_problem_notes_path(patient, @problem))
11
+ note = problem.notes.new
12
+ authorize(note)
13
+ render_form(
14
+ note,
15
+ url: patient_problem_notes_path(patient, problem)
16
+ )
17
17
  end
18
18
 
19
19
  def create
20
- load_problem
21
- note = @problem.notes.create(notes_params)
22
-
20
+ note = problem.notes.create(notes_params)
21
+ authorize(note)
23
22
  if note.save
24
23
  render_index
25
24
  else
26
- render_form(note, url: patient_problem_notes_path(patient, @problem))
25
+ render_form(
26
+ note,
27
+ url: patient_problem_notes_path(patient, problem)
28
+ )
29
+ end
30
+ end
31
+
32
+ def edit
33
+ authorize note
34
+ render_form(
35
+ note,
36
+ url: patient_problem_note_path(patient, problem, note)
37
+ )
38
+ end
39
+
40
+ def update
41
+ authorize note
42
+ if note.update_by(current_user, notes_params)
43
+ render_index
44
+ else
45
+ render_form(
46
+ note,
47
+ url: patient_problem_notes_path(patient, problem)
48
+ )
27
49
  end
28
50
  end
29
51
 
30
52
  private
31
53
 
32
- def load_problem
33
- @problem = patient.problems.find(params[:problem_id])
54
+ def problem
55
+ @problem ||= patient.problems.find(params[:problem_id])
56
+ end
57
+
58
+ def notes
59
+ @notes ||= problem.notes.includes(:updated_by).ordered
60
+ end
61
+
62
+ def note
63
+ notes.find(params[:id])
34
64
  end
35
65
 
36
66
  def render_index
37
- render "index", locals: { problem: @problem, notes: notes }
67
+ authorize(notes)
68
+ render "index", locals: { problem: problem, notes: notes }
38
69
  end
39
70
 
40
71
  def render_form(note, url:)
41
- render "form", locals: { problem: @problem, note: note, url: url }
72
+ render "form", locals: { problem: problem, note: note, url: url }
42
73
  end
43
74
 
44
75
  def notes_params
45
76
  params.require(:problems_note).permit(:description).merge(by: current_user)
46
77
  end
47
-
48
- def notes
49
- @notes ||= @problem.notes.ordered
50
- end
51
78
  end
52
79
  end
53
80
  end
@@ -17,7 +17,7 @@ FeedJob = Struct.new(:raw_message) do
17
17
  end
18
18
 
19
19
  def max_attempts
20
- 4
20
+ 2
21
21
  end
22
22
 
23
23
  def destroy_failed_jobs?
@@ -25,13 +25,12 @@ FeedJob = Struct.new(:raw_message) do
25
25
  end
26
26
 
27
27
  # Reschedule after an error. No point trying straight away, so try at these intervals:
28
- # After attempt no. Wait for hours
28
+ # After attempt no. Wait for hours
29
29
  # ---------------------------
30
30
  # 1 2
31
31
  # 2 17
32
- # 3 82
33
32
  # Then give up.
34
- # Note e.g. attempts**4 == attempts to the power of 4 == 81
33
+ # Note e.g. attempts**4 == attempts to the power of 4
35
34
  def reschedule_at(current_time, attempts)
36
35
  current_time + ((attempts**4) + 1).hours
37
36
  end
@@ -7,8 +7,6 @@ module Renalware
7
7
  module Feeds
8
8
  module_function
9
9
 
10
- class DuplicateMessageReceivedError < StandardError; end
11
-
12
10
  def table_name_prefix
13
11
  "feed_"
14
12
  end
@@ -31,9 +31,9 @@ module Renalware
31
31
  end
32
32
 
33
33
  allow_listeners_to_post_process_the_message
34
- rescue StandardError => exception
35
- notify_exception(exception)
36
- raise exception
34
+ rescue StandardError => e
35
+ notify_exception(e)
36
+ raise e
37
37
  end
38
38
 
39
39
  private
@@ -64,7 +64,7 @@ module Renalware
64
64
  # current job to retry.
65
65
  message_to_broadcast = "#{hl7_message.message_type.downcase}_message_processed"
66
66
  broadcast(message_to_broadcast.to_sym, feed_message: feed_message)
67
- rescue Feeds::DuplicateMessageReceivedError => e
67
+ rescue Feeds::DuplicateMessageError => e
68
68
  Rails.logger.warn("Rejected duplicate HL7 message: #{e.message}")
69
69
  rescue StandardError => e
70
70
  notify_exception(e)
@@ -12,6 +12,10 @@ module Renalware
12
12
  scope :ordered, -> { order(created_at: :asc) }
13
13
 
14
14
  validates :description, presence: true
15
+
16
+ def self.policy_class
17
+ BasePolicy
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -2,7 +2,7 @@
2
2
  = simple_form_for note, url: url,
3
3
  wrapper: :horizontal_form, remote: true do |f|
4
4
 
5
- = f.input :description, as: :text, input_html: { cols: 50, rows: 3 }, autofocus: true
5
+ = f.input :description, as: :text, input_html: { cols: 50, rows: 2 }, autofocus: true
6
6
 
7
7
  .row
8
8
  .large-offset-3.large-7.columns
@@ -1,10 +1,12 @@
1
- - if notes.empty?
1
+ - if notes.blank?
2
2
  #new-note-area
3
3
  spam No notes
4
4
 
5
5
  - else
6
6
  table.auto-layout
7
7
  thead
8
+ - unless problem.archived?
9
+ th.col-width-tiny
8
10
  th Description
9
11
  th.col-width-medium Recorded By
10
12
  th.col-width-date-time Recorded On
@@ -12,8 +14,12 @@
12
14
  tbody
13
15
  - notes.each do |note|
14
16
  tr
15
- td= note.description
17
+ - unless problem.archived?
18
+ td= link_to "Edit",
19
+ edit_patient_problem_note_path(problem.patient, problem, note),
20
+ remote: true
21
+ td(class="problem-note-#{note.id}")= note.description
16
22
  td= note.updated_by
17
- td= l note.updated_at
23
+ td= l(note.updated_at)
18
24
 
19
25
  #new-note-area
@@ -1,2 +1,4 @@
1
- <%= refresh("#new-note-area", partial: "form", locals: local_assigns) %>
1
+ <% div = note.persisted? ? ".problem-note-#{note.id}" : "#new-note-area" %>
2
+ <%= refresh(div, partial: "form", locals: local_assigns) %>
3
+
2
4
  $("#problems_note_description").focus();
@@ -36,7 +36,7 @@ resources :patients, except: [:destroy], controller: "patients/patients" do
36
36
  # Problems
37
37
  resources :problems, controller: "problems/problems" do
38
38
  post :sort, on: :collection
39
- resources :notes, only: [:index, :new, :create], controller: "problems/notes"
39
+ resources :notes, only: [:index, :new, :create, :edit, :update], controller: "problems/notes"
40
40
  end
41
41
 
42
42
  namespace :surveys do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.116"
4
+ VERSION = "2.0.117"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.116
4
+ version: 2.0.117
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-28 00:00:00.000000000 Z
11
+ date: 2019-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview-component