lib/tasks/fix_nil_ethnicity_arrays.rake
def fix_applicant_ethnicity_array(ethnicities, application, applicant)
      ::FinancialAssistance::Applicant.skip_callback(:update, :after, :propagate_applicant)
      applicant.ethnicity = ethnicities.compact
      updated = applicant.save(validate: false)
      ::FinancialAssistance::Applicant.set_callback(:update, :after, :propagate_applicant)
      raise StandardError, "Failed to save applicant (person_hbx_id): #{applicant.person_hbx_id}" unless updated
      result = application.primary_applicant ? application.primary_applicant.person_hbx_id : "no primary applicant for application(hbx_id): #{application.hbx_id}"
      @primary_hbx_ids << result
    rescue StandardError => e
      puts "Error updating applicant ethnicity array - #{e}"
    end
# - find draft applications that were ingested via ATP (or using provided hbx_id)
# - check and update person ethnicity array
# - check and update applicant ethnicity array
find draft applications that were ingested via ATP (or using provided hbx_id)
check and update person ethnicity array
check and update applicant ethnicity array
find draft applications that were ingested via ATP ( or using provided hbx_id ) check and update person ethnicity array check and update applicant ethnicity array
def fix_applicant_ethnicity_array(ethnicities, application, applicant)
      ::FinancialAssistance::Applicant.skip_callback(:update, :after, :propagate_applicant)
      applicant.ethnicity = ethnicities.compact
      updated = applicant.save(validate: false)
      ::FinancialAssistance::Applicant.set_callback(:update, :after, :propagate_applicant)
      raise StandardError, "Failed to save applicant (person_hbx_id): #{applicant.person_hbx_id}" unless updated
      result = application.primary_applicant ? application.primary_applicant.person_hbx_id : "no primary applicant for application(hbx_id): #{application.hbx_id}"
      @primary_hbx_ids << result
    rescue StandardError => e
      puts "Error updating applicant ethnicity array - #{e}"
    end
def fix_applicant_ethnicity_array ( ethnicities , application , applicant ) :: FinancialAssistance :: Applicant . skip_callback ( :update , :after , :propagate_applicant ) applicant . ethnicity = ethnicities . compact updated = applicant . save ( validate : false ) :: FinancialAssistance :: Applicant . set_callback ( :update , :after , :propagate_applicant ) raise StandardError , "Failed to save applicant (person_hbx_id): #{applicant.person_hbx_id}" unless updated result = application . primary_applicant ? application . primary_applicant . person_hbx_id : "no primary applicant for application(hbx_id): #{application.hbx_id}" @primary_hbx_ids << result rescue StandardError => e puts "Error updating applicant ethnicity array - #{e}" end
find draft applications that were ingested via ATP (or using provided hbx_id)
 check and update person ethnicity array
 check and update applicant ethnicity array
find draft applications that were ingested via ATP ( or using provided hbx_id ) check and update person ethnicity array check and update applicant ethnicity array
ethnicities
application
applicant