Skip to content

Commit

Permalink
Fyst 550 add healthcare screen to md flow (#5003)
Browse files Browse the repository at this point in the history
* migrations

* md healthcare screen

* fix bug with screens opening

* merge main

* remove prys

* rename controller

* merge main

* rename controller on failing test

* remove a pry

* rename had health insurance controller spec

* update complete intake spec

* pr changes

* refactor save in had health insurance form

* fix es.yml

* visual changes on reveals

* normalize

* acceptance fixes

* fix issue missing param issue in controller

---------

Co-authored-by: Drew Proebstel <[email protected]>
  • Loading branch information
DrewProebstel and Drew Proebstel authored Nov 22, 2024
1 parent 53492ff commit 85e5151
Show file tree
Hide file tree
Showing 19 changed files with 670 additions and 246 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def next_path

def form_params
params
.require(:state_file_id_grocery_credit_form)
.fetch(:state_file_id_grocery_credit_form, {})
.permit(
form_class.attribute_names +
[{ dependents_attributes: [:id, :id_has_grocery_credit_ineligible_months, :id_months_ineligible_for_grocery_credit] }])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module StateFile
module Questions
class MdHadHealthInsuranceController < QuestionsController
def form_params
if params[:state_file_md_had_health_insurance_form]
params
.fetch(:state_file_md_had_health_insurance_form, {})
.permit(
form_class.attribute_names +
[{ dependents_attributes: [:id, :md_did_not_have_health_insurance] }])
end
end
end
end
end
37 changes: 37 additions & 0 deletions app/forms/state_file/md_had_health_insurance_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module StateFile
class MdHadHealthInsuranceForm < QuestionsForm
attr_accessor :dependents_attributes
delegate :dependents, to: :intake

set_attributes_for :intake, :had_hh_member_without_health_insurance, :primary_did_not_have_health_insurance, :spouse_did_not_have_health_insurance, :authorize_sharing_of_health_insurance_info

validates :had_hh_member_without_health_insurance, presence: true
validate :one_member_did_not_have_health_insurance, if: -> { had_hh_member_without_health_insurance == "yes"}

validates :authorize_sharing_of_health_insurance_info,
presence: true,
if: -> { had_hh_member_without_health_insurance == "yes" }


def initialize(intake = nil, params = nil)
super
if params.present?
@intake.assign_attributes(dependents_attributes: dependents_attributes.to_h)
end
end

def save
base_attrs = attributes_for(:intake)
base_attrs.merge({ dependents_attributes: dependents_attributes.to_h })
@intake.update!(base_attrs)
end

private

def one_member_did_not_have_health_insurance
unless @intake.has_dependent_without_health_insurance? || spouse_did_not_have_health_insurance == "yes" || primary_did_not_have_health_insurance == "yes"
errors.add(:household_health_insurance, I18n.t("forms.errors.healthcare.one_box"))
end
end
end
end
1 change: 1 addition & 0 deletions app/lib/navigation/state_file_md_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class StateFileMdQuestionNavigation < Navigation::StateFileBaseQuestionNavigatio
Navigation::NavigationStep.new(StateFile::Questions::SpouseStateIdController),
Navigation::NavigationStep.new(StateFile::Questions::MdReviewController),
Navigation::NavigationStep.new(StateFile::Questions::TaxesOwedController),
Navigation::NavigationStep.new(StateFile::Questions::MdHadHealthInsuranceController),
Navigation::NavigationStep.new(StateFile::Questions::MdTaxRefundController),
Navigation::NavigationStep.new(StateFile::Questions::EsignDeclarationController), # creates EfileSubmission and transitions to preparing
]),
Expand Down
2 changes: 2 additions & 0 deletions app/models/state_file_dependent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# id_months_ineligible_for_grocery_credit :integer
# intake_type :string not null
# last_name :string
# md_did_not_have_health_insurance :integer default("unfilled"), not null
# middle_initial :string
# months_in_home :integer
# needed_assistance :integer default("unfilled"), not null
Expand Down Expand Up @@ -59,6 +60,7 @@ class StateFileDependent < ApplicationRecord
enum eic_disability: { unfilled: 0, yes: 1, no: 2 }, _prefix: :eic_disability
enum eic_student: { unfilled: 0, yes: 1, no: 2 }, _prefix: :eic_student
enum id_has_grocery_credit_ineligible_months: { unfilled: 0, yes: 1, no: 2 }, _prefix: :id_has_grocery_credit_ineligible_months
enum md_did_not_have_health_insurance: { unfilled: 0, yes: 1, no: 2 }, _prefix: :md_did_not_have_health_insurance

# checkboxes - "unfilled" means not-yet-seen because it saves as "no" when unchecked
enum nj_dependent_attends_accredited_program: { unfilled: 0, yes: 1, no: 2 }, _prefix: :nj_dependent_attends_accredited_program
Expand Down
176 changes: 95 additions & 81 deletions app/models/state_file_md_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,87 +2,91 @@
#
# Table name: state_file_md_intakes
#
# id :bigint not null, primary key
# account_holder_name :string
# account_number :string
# account_type :integer default("unfilled"), not null
# bank_name :string
# city :string
# confirmed_permanent_address :integer default("unfilled"), not null
# consented_to_terms_and_conditions :integer default("unfilled"), not null
# contact_preference :integer default("unfilled"), not null
# current_sign_in_at :datetime
# current_sign_in_ip :inet
# current_step :string
# date_electronic_withdrawal :date
# df_data_import_failed_at :datetime
# df_data_import_succeeded_at :datetime
# df_data_imported_at :datetime
# eligibility_filing_status_mfj :integer default("unfilled"), not null
# eligibility_home_different_areas :integer default("unfilled"), not null
# eligibility_homebuyer_withdrawal :integer default("unfilled"), not null
# eligibility_homebuyer_withdrawal_mfj :integer default("unfilled"), not null
# eligibility_lived_in_state :integer default("unfilled"), not null
# eligibility_out_of_state_income :integer default("unfilled"), not null
# email_address :citext
# email_address_verified_at :datetime
# failed_attempts :integer default(0), not null
# federal_return_status :string
# hashed_ssn :string
# last_sign_in_at :datetime
# last_sign_in_ip :inet
# locale :string default("en")
# locked_at :datetime
# message_tracker :jsonb
# payment_or_deposit_type :integer default("unfilled"), not null
# permanent_address_outside_md :integer default("unfilled"), not null
# permanent_apartment :string
# permanent_city :string
# permanent_street :string
# permanent_zip :string
# phone_number :string
# phone_number_verified_at :datetime
# political_subdivision :string
# primary_birth_date :date
# primary_esigned :integer default("unfilled"), not null
# primary_esigned_at :datetime
# primary_first_name :string
# primary_last_name :string
# primary_middle_initial :string
# primary_signature :string
# primary_signature_pin :text
# primary_ssn :string
# primary_student_loan_interest_ded_amount :decimal(12, 2) default(0.0), not null
# primary_suffix :string
# raw_direct_file_data :text
# raw_direct_file_intake_data :jsonb
# referrer :string
# residence_county :string
# routing_number :string
# sign_in_count :integer default(0), not null
# source :string
# spouse_birth_date :date
# spouse_esigned :integer default("unfilled"), not null
# spouse_esigned_at :datetime
# spouse_first_name :string
# spouse_last_name :string
# spouse_middle_initial :string
# spouse_signature_pin :text
# spouse_ssn :string
# spouse_student_loan_interest_ded_amount :decimal(12, 2) default(0.0), not null
# spouse_suffix :string
# street_address :string
# subdivision_code :string
# unfinished_intake_ids :text default([]), is an Array
# unsubscribed_from_email :boolean default(FALSE), not null
# withdraw_amount :decimal(12, 2)
# zip_code :string
# created_at :datetime not null
# updated_at :datetime not null
# federal_submission_id :string
# primary_state_id_id :bigint
# spouse_state_id_id :bigint
# visitor_id :string
# id :bigint not null, primary key
# account_holder_name :string
# account_number :string
# account_type :integer default("unfilled"), not null
# authorize_sharing_of_health_insurance_info :integer default("unfilled"), not null
# bank_name :string
# city :string
# confirmed_permanent_address :integer default("unfilled"), not null
# consented_to_terms_and_conditions :integer default("unfilled"), not null
# contact_preference :integer default("unfilled"), not null
# current_sign_in_at :datetime
# current_sign_in_ip :inet
# current_step :string
# date_electronic_withdrawal :date
# df_data_import_failed_at :datetime
# df_data_import_succeeded_at :datetime
# df_data_imported_at :datetime
# eligibility_filing_status_mfj :integer default("unfilled"), not null
# eligibility_home_different_areas :integer default("unfilled"), not null
# eligibility_homebuyer_withdrawal :integer default("unfilled"), not null
# eligibility_homebuyer_withdrawal_mfj :integer default("unfilled"), not null
# eligibility_lived_in_state :integer default("unfilled"), not null
# eligibility_out_of_state_income :integer default("unfilled"), not null
# email_address :citext
# email_address_verified_at :datetime
# failed_attempts :integer default(0), not null
# federal_return_status :string
# had_hh_member_without_health_insurance :integer default("unfilled"), not null
# hashed_ssn :string
# last_sign_in_at :datetime
# last_sign_in_ip :inet
# locale :string default("en")
# locked_at :datetime
# message_tracker :jsonb
# payment_or_deposit_type :integer default("unfilled"), not null
# permanent_address_outside_md :integer default("unfilled"), not null
# permanent_apartment :string
# permanent_city :string
# permanent_street :string
# permanent_zip :string
# phone_number :string
# phone_number_verified_at :datetime
# political_subdivision :string
# primary_birth_date :date
# primary_did_not_have_health_insurance :integer default("unfilled"), not null
# primary_esigned :integer default("unfilled"), not null
# primary_esigned_at :datetime
# primary_first_name :string
# primary_last_name :string
# primary_middle_initial :string
# primary_signature :string
# primary_signature_pin :text
# primary_ssn :string
# primary_student_loan_interest_ded_amount :decimal(12, 2) default(0.0), not null
# primary_suffix :string
# raw_direct_file_data :text
# raw_direct_file_intake_data :jsonb
# referrer :string
# residence_county :string
# routing_number :string
# sign_in_count :integer default(0), not null
# source :string
# spouse_birth_date :date
# spouse_did_not_have_health_insurance :integer default("unfilled"), not null
# spouse_esigned :integer default("unfilled"), not null
# spouse_esigned_at :datetime
# spouse_first_name :string
# spouse_last_name :string
# spouse_middle_initial :string
# spouse_signature_pin :text
# spouse_ssn :string
# spouse_student_loan_interest_ded_amount :decimal(12, 2) default(0.0), not null
# spouse_suffix :string
# street_address :string
# subdivision_code :string
# unfinished_intake_ids :text default([]), is an Array
# unsubscribed_from_email :boolean default(FALSE), not null
# withdraw_amount :decimal(12, 2)
# zip_code :string
# created_at :datetime not null
# updated_at :datetime not null
# federal_submission_id :string
# primary_state_id_id :bigint
# spouse_state_id_id :bigint
# visitor_id :string
#
# Indexes
#
Expand All @@ -103,6 +107,10 @@ class StateFileMdIntake < StateFileBaseIntake
enum eligibility_home_different_areas: { unfilled: 0, yes: 1, no: 2 }, _prefix: :eligibility_home_different_areas
enum confirmed_permanent_address: { unfilled: 0, yes: 1, no: 2 }, _prefix: :confirmed_permanent_address
enum permanent_address_outside_md: { unfilled: 0, yes: 1, no: 2 }, _prefix: :permanent_address_outside_md
enum had_hh_member_without_health_insurance: { unfilled: 0, yes: 1, no: 2, prefer_not_to_answer: 3 }, _prefix: :had_hh_member_without_health_insurance
enum authorize_sharing_of_health_insurance_info: { unfilled: 0, yes: 1, no: 2}, _prefix: :authorize_sharing_of_health_insurance_info
enum primary_did_not_have_health_insurance: { unfilled: 0, yes: 1, no: 2}, _prefix: :primary_did_not_have_health_insurance
enum spouse_did_not_have_health_insurance: { unfilled: 0, yes: 1, no: 2}, _prefix: :spouse_did_not_have_health_insurance

def disqualifying_df_data_reason
w2_states = direct_file_data.parsed_xml.css('W2StateLocalTaxGrp W2StateTaxGrp StateAbbreviationCd')
Expand Down Expand Up @@ -152,6 +160,12 @@ def filing_status
}[direct_file_data&.filing_status]
end

def has_dependent_without_health_insurance?
dependents.any? do |dependent|
dependent.md_did_not_have_health_insurance_yes?
end
end

def filing_status_dependent?
filing_status == :dependent
end
Expand Down
Loading

0 comments on commit 85e5151

Please sign in to comment.