Browse Source

Consider everyone below 18 a child (#1195)

pull/1165/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
64f245d066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/models/derived_variables/sales_log_variables.rb
  2. 2
      spec/models/sales_log_spec.rb

4
app/models/derived_variables/sales_log_variables.rb

@ -33,7 +33,7 @@ private
(2..6).count do |i|
age = public_send("age#{i}")
relat = public_send("relat#{i}")
age.present? && ((age < 20 && %w[C].include?(relat)))
age.present? && (age < 20 && %w[C].include?(relat) || age < 18)
end
end
@ -42,7 +42,7 @@ private
total + (2..6).count do |i|
age = public_send("age#{i}")
relat = public_send("relat#{i}")
age.present? && ((age.between?(20, 59) || age.between?(18, 19) && relat != "C"))
age.present? && (age.between?(20, 59) || age.between?(18, 19) && relat != "C")
end
end

2
spec/models/sales_log_spec.rb

@ -240,7 +240,7 @@ RSpec.describe SalesLog, type: :model do
relat2: "C",
relat3: "C",
relat4: "X",
relat5: "C",
relat5: "X",
age1: 22,
age2: 40,
age3: 19,

Loading…
Cancel
Save