Class: Fe::UpdateReferenceSheetVisibilityJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/fe/update_reference_sheet_visibility_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(answer_sheet, question_ids) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'app/jobs/fe/update_reference_sheet_visibility_job.rb', line 2

def perform(answer_sheet, question_ids)
  answer_sheet.question_sheets_all_reference_elements.each do |r|
    if (r.visibility_affecting_element_ids & question_ids).any?
      answer_sheet.all_references.where(question_id: r.id).each do |ref|
        ref.update_visible
      end
    end
  end
end