File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,13 +24,8 @@ def full_name
2424 end
2525
2626 def weight
27- if observations . map ( &:code_display ) . include? ( "Body Weight" )
28- body_weight_observation = [ observations . select { |observation | observation . code_display == "Body Weight" } ] . flatten . sort_by ( &:date ) . last
29- weight = "#{ body_weight_observation . value } #{ body_weight_observation . units } "
30- else
31- weight = "N/A"
32- end
33- weight
27+ body_weight_observation = observations . select { |observation | observation . code_display == "Body Weight" }
28+ Weight . new ( body_weight_observation ) . to_s
3429 end
3530
3631 def birthday
Original file line number Diff line number Diff line change 1+ class Weight
2+ def initialize ( observation )
3+ return unless observation . present?
4+ @weight = observation . value
5+ @unit = observation . units
6+ end
7+
8+ def to_s
9+ return 'N/A' unless @weight . present?
10+ "#{ @weight } #{ @unit } "
11+ end
12+ end
You can’t perform that action at this time.
0 commit comments