Class: BGS::DisabilityCompensationFormFlashes

Inherits:
Object
  • Object
show all
Defined in:
lib/bgs/disability_compensation_form_flashes.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, form_content, claimed_disabilities) ⇒ DisabilityCompensationFormFlashes

Returns a new instance of DisabilityCompensationFormFlashes.



5
6
7
8
9
10
# File 'lib/bgs/disability_compensation_form_flashes.rb', line 5

def initialize(user, form_content, claimed_disabilities)
  @user = user
  @form_content = form_content['form526']
  @claimed_disabilities = claimed_disabilities
  @flashes = []
end

Instance Method Details

#als?Boolean

Returns:

  • (Boolean)


56
57
58
59
60
61
62
63
64
# File 'lib/bgs/disability_compensation_form_flashes.rb', line 56

def als?
  feature_enabled = Flipper.enabled?(:disability_526_ee_process_als_flash, @user)
  add_als = ClaimFastTracking::FlashPicker.als?(@claimed_disabilities)
  Rails.logger.info('FlashPicker for ALS', { feature_enabled: }) if add_als
  feature_enabled && add_als
rescue => e
  Rails.logger.error("Failed to determine need for ALS flash: #{e.message}.", backtrace: e.backtrace)
  false
end

#homeless?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/bgs/disability_compensation_form_flashes.rb', line 40

def homeless?
  @form_content['homelessOrAtRisk'] == 'homeless'
end

#over_85?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/bgs/disability_compensation_form_flashes.rb', line 48

def over_85?
  85.years.ago > @user.birth_date.to_date
end

#pow?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/bgs/disability_compensation_form_flashes.rb', line 52

def pow?
  @form_content['confinements'].present?
end

#terminally_ill?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/bgs/disability_compensation_form_flashes.rb', line 44

def terminally_ill?
  @form_content['isTerminallyIll'] == true
end

#translateHash

Merges the user data and performs the translation

we’ve started with the flashes that are the most straightforward to determine, but should consider these flashes soon

“Agent Orange - Vietnam”, “Amyotrophic Lateral Sclerosis”, “Blind”, “Blue Water Navy”, “Formerly Homeless”, “GW Undiagnosed Illness”, “Hardship”, “Medal of Honor”, “Purple Heart”, “Seriously Injured/Very Seriously Injured”, “Specially Adapted Housing Claimed”,

Returns:

  • (Hash)

    The translated form(s) ready for submission



31
32
33
34
35
36
37
38
# File 'lib/bgs/disability_compensation_form_flashes.rb', line 31

def translate
  @flashes << 'Homeless' if homeless?
  @flashes << 'Terminally Ill' if terminally_ill?
  @flashes << 'Priority Processing - Veteran over age 85' if over_85?
  @flashes << 'POW' if pow?
  @flashes << 'Amyotrophic Lateral Sclerosis' if als?
  @flashes
end