Class: EducationForm::Forms::VA0994

Inherits:
Base
  • Object
show all
Defined in:
app/sidekiq/education_form/forms/va_0994.rb

Constant Summary collapse

HIGH_TECH_AREA_NAMES =
{
  computerProgramming: 'Computer programming',
  dataProcessing: 'Data processing',
  computerSoftware: 'Computer software',
  informationSciences: 'Information sciences',
  mediaApplication: 'Media application'
}.freeze
SALARY_TEXT =
{
  lessThanTwenty: '<$20,000',
  twentyToThirtyFive: '$20,000-$35,000',
  thirtyFiveToFifty: '$35,000-$50,000',
  fiftyToSeventyFive: '$50,000-$75,000',
  moreThanSeventyFive: '>$75,000'
}.freeze
EDUCATION_TEXT =
{
  some_high_school: 'Some High School',
  high_school_diploma_or_GED: 'High school diploma or GED',
  some_college: 'Some college',
  associates_degree: 'Associate’s degree',
  bachelors_degree: 'Bachelor’s degree',
  masters_degree: 'Master’s degree',
  doctoral_degree: 'Doctoral degree',
  other: 'Other'
}.freeze
COURSE_TYPE_TEXT =
{
  inPerson: 'In Person',
  online: 'Online',
  both: 'Both'
}.freeze

Constants inherited from Base

Base::TEMPLATE_PATH

Instance Attribute Summary

Attributes inherited from Base

#form, #record, #text

Instance Method Summary collapse

Methods inherited from Base

build, #direct_deposit_type, #disclosure_for, #employment_history, #format, #full_address, #full_name, #get_template, #header, #hours_and_type, #initialize, #parse_with_template, #parse_with_template_path, #school, #school_name, #school_name_and_addr, #ssn_gender_dob, #to_date, #value_or_na, #yesno, #yesno_or_blank

Constructor Details

This class inherits a constructor from EducationForm::Forms::Base

Instance Method Details

#applicant_nameObject



46
47
48
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 46

def applicant_name
  @applicant.applicantFullName
end

#applicant_ssnObject



50
51
52
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 50

def applicant_ssn
  @applicant.applicantSocialSecurityNumber
end

#bank_account_numberObject



68
69
70
71
72
73
74
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 68

def 
  if @applicant.bankAccount&.accountNumber.present?
    @applicant.bankAccount.accountNumber
  elsif !new_bank_info?
    @applicant.prefillBankAccount&.bankAccountNumber
  end
end

#bank_account_typeObject



76
77
78
79
80
81
82
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 76

def 
  if @applicant.bankAccount&.accountType.present?
    @applicant.bankAccount.accountType
  elsif !new_bank_info?
    @applicant.prefillBankAccount&.bankAccountType
  end
end

#bank_routing_numberObject



60
61
62
63
64
65
66
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 60

def bank_routing_number
  if @applicant.bankAccount&.routingNumber.present?
    @applicant.bankAccount.routingNumber
  elsif !new_bank_info?
    @applicant.prefillBankAccount&.bankRoutingNumber
  end
end

#benefit_typeObject



9
10
11
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 9

def benefit_type
  'VetTec'
end

#course_type_name(course_type) ⇒ Object



108
109
110
111
112
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 108

def course_type_name(course_type)
  return '' if course_type.blank?

  COURSE_TYPE_TEXT[course_type.to_sym]
end

#education_level_nameObject



101
102
103
104
105
106
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 101

def education_level_name
  return '' if @applicant.highestLevelofEducation.blank?
  return @applicant.otherEducation if @applicant.highestLevelofEducation == 'other'

  EDUCATION_TEXT[@applicant.highestLevelofEducation.to_sym]
end

#full_address_with_street3(address, indent: false) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
158
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 147

def full_address_with_street3(address, indent: false)
  return '' if address.nil?

  seperator = indent ? "\n        " : "\n"
  [
    address.street,
    address.street2,
    address.street3,
    [address.city, address.state, address.postalCode].compact.join(', '),
    address.country
  ].compact.join(seperator).upcase
end

#get_program_block(program) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 121

def get_program_block(program)
  city = program.courseType == 'online' && program.location&.city.blank? ? 'N/A' : program.location&.city
  state = program.courseType == 'online' && program.location&.state.blank? ? 'N/A' : program.location&.state

  [
    ["\n  Provider name: ", program.providerName].join,
    ["\n  Program name: ", program.programName].join,
    ["\n  Course type: ", course_type_name(program.courseType)].join,
    "\n  Location:",
    ["\n    City: ", city].join,
    ["\n    State: ", state].join,
    ["\n  Planned start date: ", program.plannedStartDate].join
  ].join
end

#header_form_typeObject



5
6
7
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 5

def header_form_type
  'V0994'
end

#high_tech_area_namesObject



90
91
92
93
94
95
96
97
98
99
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 90

def high_tech_area_names
  return 'N/A' unless @applicant.currentHighTechnologyEmployment
  return '' if @applicant.highTechnologyEmploymentTypes.blank?

  areas = []
  @applicant.highTechnologyEmploymentTypes.each do |area|
    areas.push(HIGH_TECH_AREA_NAMES[area.to_sym])
  end
  areas.join("\n")
end

#locationObject



84
85
86
87
88
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 84

def location
  return '' if @applicant.vetTecProgramLocations.blank?

  "#{@applicant.vetTecProgramLocations.city}, #{@applicant.vetTecProgramLocations.state}"
end

#new_bank_info?Boolean

Returns:

  • (Boolean)


54
55
56
57
58
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 54

def new_bank_info?
  @applicant.bankAccount&.routingNumber.present? ||
    @applicant.bankAccount&.accountNumber.present? ||
    @applicant.bankAccount&.accountType.present?
end

#program_textObject



136
137
138
139
140
141
142
143
144
145
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 136

def program_text
  return '' if @applicant.vetTecPrograms.blank? && @applicant.hasSelectedPrograms
  return 'N/A' if @applicant.hasSelectedPrograms.blank?

  program_blocks = []
  @applicant.vetTecPrograms.each do |program|
    program_blocks.push(get_program_block(program))
  end
  program_blocks.join("\n")
end

#salary_textObject



114
115
116
117
118
119
# File 'app/sidekiq/education_form/forms/va_0994.rb', line 114

def salary_text
  return 'N/A' unless @applicant.currentHighTechnologyEmployment
  return '' if @applicant.currentSalary.blank?

  SALARY_TEXT[@applicant.currentSalary.to_sym]
end