renalware-core 2.0.1 → 2.0.2

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: 64747fcbe0c225da4849524e902ca6e9a312e11d2275f15c981e9a9d1f2049d1
4
- data.tar.gz: d35406e231ad5ecfe6e27ef6cc483a1d492830b7fda2532bbd0272f1fff39c8a
3
+ metadata.gz: 8f579d475315f2250e3bd086f651bcb9fc0c38838f74b649fb9f439fdb21b4db
4
+ data.tar.gz: 7ab7db9d4572a88eef14a8a0dd3ce0ed47c741c07f1838cb24cb856177aac239
5
5
  SHA512:
6
- metadata.gz: 6e0dbb5fac278d6ee1e57f1c439508190213b39d295068cd7cefe19a5c0d9b449bda73cef380676ef9f04a29663599394afefd37fd1720b3aaa020582feab9c1
7
- data.tar.gz: 67b85bed5851f4b40c930a3e11b996541b90c7aee8e9dff24a0965b1e3e92ebe2786284d64a8bb88054de7c0c90536984a9169238b5ab0edf2949eb18c29650e
6
+ metadata.gz: cc57a5702a16893bdd206b58ec3b124b947d0c0694a45fb1dd63069de8521e8900f3b2496cb055ec75defcbad3935f8bbb93d9ef382f8859a826efa8b738524b
7
+ data.tar.gz: f01dbf8296ec8c9e1df88862270393dd0a19de91db300a1c30483d906ff6a60d7de24808a7089806b86f124bd09126e1673853d0edf0b39402dfb03c1b4ad4e0
@@ -92,7 +92,7 @@ module Renalware
92
92
  end
93
93
 
94
94
  def subject?(other_patient)
95
- patient == other_patient
95
+ patient.id == other_patient.id
96
96
  end
97
97
 
98
98
  def find_cc_recipient_for_contact(contact)
@@ -32,11 +32,10 @@ module Renalware
32
32
  end
33
33
 
34
34
  def current_address
35
- case
36
- when patient?
35
+ if patient?
37
36
  letter.patient.current_address
38
- when primary_care_physician?
39
- letter.primary_care_physician.current_address
37
+ elsif primary_care_physician?
38
+ address_for_primary_care_physician
40
39
  else
41
40
  addressee.address
42
41
  end
@@ -49,6 +48,14 @@ module Renalware
49
48
 
50
49
  private
51
50
 
51
+ def address_for_primary_care_physician
52
+ address = letter.patient&.practice&.address
53
+ if address.present? && letter.primary_care_physician.present?
54
+ address.name = letter.primary_care_physician.salutation
55
+ end
56
+ address
57
+ end
58
+
52
59
  def patient_or_primary_care_physician?
53
60
  patient? || primary_care_physician?
54
61
  end
@@ -46,8 +46,14 @@ module Renalware
46
46
  [title, name].join(" ")
47
47
  end
48
48
 
49
+ class PrimaryCarePhysicianAddressAccessError < StandardError; end
49
50
  def current_address
50
- address || practice_address
51
+ raise PrimaryCarePhysicianAddressAccessError,
52
+ "primary_care_physician#current_address should not be called: "\
53
+ "we always use the patient.practice.address when contacting the GP. "\
54
+ "In a sense the practice is more important that the GP, as the GP may have "\
55
+ "moved on"
56
+ # address || practice_address
51
57
  end
52
58
 
53
59
  def practice_address
@@ -7,7 +7,9 @@ module Renalware
7
7
  class LetterFormPresenter < DumbDelegator
8
8
  def person_roles
9
9
  [].tap do |collection|
10
- collection << primary_care_physician_role if patient.primary_care_physician.present?
10
+ if patient.primary_care_physician.present? && patient.practice.present?
11
+ collection << primary_care_physician_role
12
+ end
11
13
  collection << patient_role
12
14
  collection << other_role
13
15
  end
@@ -38,7 +40,7 @@ module Renalware
38
40
 
39
41
  def primary_care_physician_role
40
42
  label = "Primary Care Physician <address>#{primary_care_physician.name}, " \
41
- "#{primary_care_physician.address}</address>".html_safe
43
+ "#{patient.practice&.address}</address>".html_safe
42
44
  [label, "primary_care_physician", primary_care_physician.salutation]
43
45
  end
44
46
 
@@ -1,7 +1,6 @@
1
1
  .modal
2
2
  .modal__header
3
3
  h2= "Was printing successful?"
4
- /= render "renalware/shared/modal_close_link"
5
4
  .modal__body
6
5
  dl.dl-horizontal
7
6
  dt Patient
@@ -5,10 +5,12 @@ article
5
5
  = f.simple_fields_for :main_recipient do |fmr|
6
6
 
7
7
  .radio_buttons.row.optional.letter_main_recipient_person_role.field_with_hint
8
- .columns.small-3
9
- label.right.inline.radio_buttons.optional Recipient
10
- .columns.small-9
11
-
8
+ .columns.small-12
9
+ .hint
10
+ - if patient.primary_care_physician.nil? || patient.practice.nil?
11
+ | No option to send to GP as patient has no Practice and/or GP
12
+ br
13
+ =f.object.patient_cc_hint
12
14
  = fmr.collection_radio_buttons(:person_role,
13
15
  f.object.person_roles,
14
16
  :second,
@@ -21,7 +23,6 @@ article
21
23
  class: "radio_buttons recipient-person-role-picker has_salutation") \
22
24
  + b.text \
23
25
  }
24
- .hint=f.object.patient_cc_hint
25
26
 
26
27
  = fmr.input :id, as: :hidden
27
28
 
@@ -34,4 +34,4 @@
34
34
  / for the complete works. Using ujs for these sort of dialog -> -> post -> page refresh
35
35
  / cycles is a bit complex and we could move to using something like stimulus
36
36
  / to keep thing a bit simpler
37
- #letter-print-modal.reveal-modal.small(data-reveal data-refresh-url=request.original_fullpath)
37
+ #letter-print-modal.reveal-modal.medium(data-reveal data-refresh-url=request.original_fullpath)
@@ -1,3 +1,3 @@
1
1
  module Renalware
2
- VERSION = "2.0.1".freeze
2
+ VERSION = "2.0.2".freeze
3
3
  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.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-11 00:00:00.000000000 Z
11
+ date: 2018-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails