Browse Source

Send rather than eval

pull/159/head
baarkerlounger 3 years ago
parent
commit
d600edc2eb
  1. 6
      app/models/case_log.rb

6
app/models/case_log.rb

@ -238,10 +238,8 @@ private
def get_totadult def get_totadult
total = !age1.nil? && age1 >= 16 && age1 < 60 ? 1 : 0 total = !age1.nil? && age1 >= 16 && age1 < 60 ? 1 : 0
total + (2..8).count do |i| total + (2..8).count do |i|
# rubocop:disable Style/EvalWithLocation, Security/Eval:: age = public_send("age#{i}")
age = eval("age#{i}") relat = public_send("relat#{i}")
relat = eval("relat#{i}")
# rubocop:enable Style/EvalWithLocation, Security/Eval::
!age.nil? && ((age >= 16 && age < 18 && %w[Partner Other].include?(relat)) || age >= 18 && age < 60) !age.nil? && ((age >= 16 && age < 18 && %w[Partner Other].include?(relat)) || age >= 18 && age < 60)
end end
end end

Loading…
Cancel
Save