Browse Source

rubocop

pull/322/head
Kat 3 years ago
parent
commit
dcaa730e4d
  1. 4
      app/models/case_log.rb
  2. 3
      spec/models/case_log_spec.rb

4
app/models/case_log.rb

@ -217,8 +217,8 @@ private
form.invalidated_page_questions(self).each do |question|
enabled = form.enabled_page_questions(self)
contains_selected_answer_option = enabled.map(&:id).include?(question.id) && enabled.find { |q| q.id == question.id }.answer_options.values.map { |x| x["value"] }.include?(public_send(question.id))
unless contains_selected_answer_option
public_send("#{question.id}=", nil) if respond_to?(question.id.to_s)
if !contains_selected_answer_option && respond_to?(question.id.to_s)
public_send("#{question.id}=", nil)
end
end
end

3
spec/models/case_log_spec.rb

@ -538,7 +538,7 @@ RSpec.describe CaseLog do
it "does clear the value for answers that do not apply for invalidated page" do
case_log.update!({ wchair: "Yes", sex2: "Female", age2: 33 })
case_log.update!({ cbl: "No" })
case_log.update!({ cbl: "No" })
case_log.update!({ preg_occ: "Yes" })
expect(case_log.cbl).to eq(nil)
@ -581,7 +581,6 @@ RSpec.describe CaseLog do
expect(case_log["layear"]).to eq("1 year but under 2 years")
end
end
end
describe "paper trail" do

Loading…
Cancel
Save