Skip to content

Commit

Permalink
Merge pull request #1511 from nikobozi/enhancement/1497
Browse files Browse the repository at this point in the history
New checkbox field for ultrasound info
  • Loading branch information
colinxfleming committed Oct 29, 2018
2 parents 4eec042 + 3377828 commit 3a1a80b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/patients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def find_patient
].freeze

ABORTION_INFORMATION_PARAMS = [
:clinic_id, :resolved_without_fund, :referred_to_clinic,
:clinic_id, :resolved_without_fund, :referred_to_clinic, :completed_ultrasound,
:procedure_cost, :patient_contribution, :naf_pledge, :fund_pledge
].freeze

Expand Down
4 changes: 4 additions & 0 deletions app/helpers/tooltips_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@ def referred_to_clinic_help_text
particular clinic.
TEXT
end

def mandatory_ultrasound_help_text
'If you are in a state that requires ultrasounds and the patient has completed one, you can log it here.'
end
end
1 change: 1 addition & 0 deletions app/models/patient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Patient
field :special_circumstances, type: Array, default: []
field :referred_by, type: String
field :referred_to_clinic, type: Boolean
field :completed_ultrasound, type: Boolean

# Status and pledge related fields
field :appointment_date, type: Date
Expand Down
4 changes: 4 additions & 0 deletions app/views/patients/_abortion_information.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
label: 'Referred to clinic',
label_class: 'tooltip-header-checkbox',
data: { 'tooltip-text': referred_to_clinic_help_text } %>
<%= f.check_box :completed_ultrasound,
label: 'Ultrasound completed?',
label_class: 'tooltip-header-checkbox',
data: { 'tooltip-text': mandatory_ultrasound_help_text } %>
</div>
</div>
<% end %>
Expand Down
2 changes: 2 additions & 0 deletions test/system/update_patient_info_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class UpdatePatientInfoTest < ApplicationSystemTestCase
select @clinic.name, from: 'patient_clinic_id'
check 'Resolved without assistance from DCAF'
check 'Referred to clinic'
check 'Ultrasound completed?'

fill_in 'Abortion cost', with: '300'
fill_in 'Patient contribution', with: '200'
Expand Down Expand Up @@ -154,6 +155,7 @@ class UpdatePatientInfoTest < ApplicationSystemTestCase
assert_equal @clinic.id.to_s, find('#patient_clinic_id').value
assert has_checked_field?('Resolved without assistance from DCAF')
assert has_checked_field?('Referred to clinic')
assert has_checked_field?('Ultrasound completed?')

assert has_field? 'Abortion cost', with: '300'
assert has_field? 'Patient contribution', with: '200'
Expand Down

0 comments on commit 3a1a80b

Please sign in to comment.