Browse Source

Update app/models/case_log.rb

Use map rather than indexing

Co-authored-by: Daniel Baark <5101747+baarkerlounger@users.noreply.github.com>
pull/63/head
Milo 3 years ago committed by GitHub
parent
commit
8d3e31ee10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/models/case_log.rb

6
app/models/case_log.rb

@ -62,7 +62,11 @@ class CaseLogValidator < ActiveModel::Validator
end end
end end
p = 2 (2..8).map do |n|
next if record["person_#{n}_gender"].nil? || record["person_#{n}_age"].nil?
record["person_#{n}_gender"] == "Female" && record["person_#{n}_age"] >= 16 && record["person_#{n}_age"] <= 50
end
while p <= 8 while p <= 8
unless record["person_#{p}_gender"].nil? || record["person_#{p}_age"].nil? unless record["person_#{p}_gender"].nil? || record["person_#{p}_age"].nil?
if record["person_#{p}_gender"] == "Female" && record["person_#{p}_age"] >= 16 && record["person_#{p}_age"] <= 50 if record["person_#{p}_gender"] == "Female" && record["person_#{p}_age"] >= 16 && record["person_#{p}_age"] <= 50

Loading…
Cancel
Save