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
100
101
102
103
104
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 100
def anticoagulant_stop_time
return if anticoagulant.stop_time.blank?
Duration.from_minutes(anticoagulant.stop_time).to_s
end
|
#blood_flow ⇒ Object
96
97
98
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 96
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
|
90
91
92
93
94
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 90
def formatted_prescribed_time
return unless prescribed_time
::Renalware::Duration.from_minutes(prescribed_time).to_s
end
|
#hd_type ⇒ Object
82
83
84
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 82
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
78
79
80
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 78
def last_update
"#{::I18n.l(updated_at)} by #{updated_by}"
end
|
#prescribed_times ⇒ Object
86
87
88
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 86
def prescribed_times
(60..360).step(15).map { |mins| [Duration.from_minutes(mins).to_s, mins] }
end
|
#schedule_definitions ⇒ Object
71
72
73
74
75
76
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 71
def schedule_definitions
ScheduleDefinition
.includes(:diurnal_period)
.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
106
107
108
109
110
|
# File 'app/presenters/renalware/hd/profile_presenter.rb', line 106
def transport_summary
return if transport.blank?
[transport.has_transport&.text, transport.type&.text].compact.join(": ")
end
|