Class: Renalware::HD::ProfilePresenter
Instance Attribute Summary collapse
Instance Method Summary
collapse
#inspect, #public_send, #send, #try, #try!
Constructor Details
#initialize(profile, preference_set: nil) ⇒ ProfilePresenter
Returns a new instance of ProfilePresenter.
44
45
46
47
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 44
def initialize(profile, preference_set: nil)
super(profile)
@preference_set = preference_set
end
|
Instance Attribute Details
#preference_set ⇒ Object
Returns the value of attribute preference_set.
6
7
8
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 6
def preference_set
@preference_set
end
|
Instance Method Details
#anticoagulant_stop_time ⇒ Object
97
98
99
100
101
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 97
def anticoagulant_stop_time
return if anticoagulant.stop_time.blank?
Duration.from_minutes(anticoagulant.stop_time).to_s
end
|
#blood_flow ⇒ Object
93
94
95
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 93
def blood_flow
"#{dialysis.blood_flow} ml/min" if dialysis.blood_flow.present?
end
|
#current_schedule ⇒ Object
65
66
67
68
69
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 65
def current_schedule
return other_schedule if other_schedule.present?
schedule_definition
end
|
#document ⇒ Object
49
50
51
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 49
def document
ProfileDocumentPresenter.new(__getobj__.document)
end
|
87
88
89
90
91
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 87
def formatted_prescribed_time
return unless prescribed_time
::Renalware::Duration.from_minutes(prescribed_time).to_s
end
|
#hd_type ⇒ Object
79
80
81
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 79
def hd_type
document.dialysis.hd_type.try(:text)
end
|
#hospital_unit_hint ⇒ Object
53
54
55
56
57
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 53
def hospital_unit_hint
if preference_set.hospital_unit.present?
"Preference: #{@preference_set.hospital_unit}"
end
end
|
#last_update ⇒ Object
75
76
77
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 75
def last_update
"#{::I18n.l(updated_at)} by #{updated_by}"
end
|
#prescribed_times ⇒ Object
83
84
85
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 83
def prescribed_times
(60..360).step(15).map { |mins| [Duration.from_minutes(mins).to_s, mins] }
end
|
#schedule_definitions ⇒ Object
71
72
73
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 71
def schedule_definitions
ScheduleDefinition.ordered.map{ |definition| [definition.to_s, definition.id] }
end
|
#schedule_hint ⇒ Object
59
60
61
62
63
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 59
def schedule_hint
return if preference_set.preferred_schedule.blank?
"Preference: #{@preference_set.preferred_schedule}"
end
|
#transport_summary ⇒ Object
103
104
105
106
107
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 103
def transport_summary
return if transport.blank?
[transport.has_transport&.text, transport.type&.text].compact.join(": ")
end
|