Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GYR1-605 Add visa question and flip citizen question on life situations screens #5246

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions app/forms/life_situations_form.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
class LifeSituationsForm < QuestionsForm
set_attributes_for :intake, :was_full_time_student, :primary_not_us_citizen, :had_disability, :was_blind
set_attributes_for :intake, :was_full_time_student, :primary_us_citizen, :primary_visa, :had_disability, :was_blind
set_attributes_for :confirmation, :no_life_situations_apply
validates :no_life_situations_apply, at_least_one_or_none_of_the_above_selected: true

def at_least_one_selected
was_full_time_student == "yes" ||
primary_not_us_citizen == "yes" ||
primary_us_citizen == "yes" ||
had_disability == "yes" ||
was_blind == "yes"
end

def self.existing_attributes(intake)
result = super
result[:primary_not_us_citizen] = result.delete(:primary_us_citizen) == 'no' ? 'yes' : 'no'
result
end

def save
modified_attributes = attributes_for(:intake)
modified_attributes[:primary_us_citizen] = modified_attributes.delete(:primary_not_us_citizen) == "yes" ? "no" : "yes"

@intake.update(modified_attributes)
end
end
end
8 changes: 3 additions & 5 deletions app/forms/spouse_life_situations_form.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
class SpouseLifeSituationsForm < QuestionsForm
set_attributes_for :intake, :spouse_was_full_time_student, :spouse_not_us_citizen, :spouse_had_disability, :spouse_was_blind
set_attributes_for :intake, :spouse_was_full_time_student, :spouse_us_citizen, :spouse_visa, :spouse_had_disability, :spouse_was_blind
set_attributes_for :confirmation, :no_life_situations_apply
validates :no_life_situations_apply, at_least_one_or_none_of_the_above_selected: true
def at_least_one_selected
spouse_was_full_time_student == "yes" ||
spouse_not_us_citizen == "yes" ||
spouse_us_citizen == "yes" ||
spouse_had_disability == "yes" ||
spouse_was_blind == "yes"
end

def self.existing_attributes(intake)
result = super
result[:spouse_not_us_citizen] = result.delete(:spouse_us_citizen) == 'no' ? 'yes' : 'no'
result
end

def save
modified_attributes = attributes_for(:intake)
modified_attributes[:spouse_us_citizen] = modified_attributes.delete(:spouse_not_us_citizen) == "yes" ? "no" : "yes"

@intake.update(modified_attributes)
end
end
end
2 changes: 2 additions & 0 deletions app/models/intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
# primary_suffix :string
# primary_tin_type :integer
# primary_us_citizen :integer default(0), not null
# primary_visa :integer default(0), not null
# product_year :integer not null
# receive_written_communication :integer default(0), not null
# received_advance_ctc_payment :integer
Expand Down Expand Up @@ -237,6 +238,7 @@
# spouse_suffix :string
# spouse_tin_type :integer
# spouse_us_citizen :integer default(0), not null
# spouse_visa :integer default(0), not null
# spouse_was_blind :integer default(0), not null
# spouse_was_full_time_student :integer default(0), not null
# state :string
Expand Down
2 changes: 2 additions & 0 deletions app/models/intake/ctc_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
# primary_suffix :string
# primary_tin_type :integer
# primary_us_citizen :integer default(0), not null
# primary_visa :integer default(0), not null
# product_year :integer not null
# receive_written_communication :integer default(0), not null
# received_advance_ctc_payment :integer
Expand Down Expand Up @@ -237,6 +238,7 @@
# spouse_suffix :string
# spouse_tin_type :integer
# spouse_us_citizen :integer default(0), not null
# spouse_visa :integer default(0), not null
# spouse_was_blind :integer default("unfilled"), not null
# spouse_was_full_time_student :integer default(0), not null
# state :string
Expand Down
4 changes: 4 additions & 0 deletions app/models/intake/gyr_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
# primary_suffix :string
# primary_tin_type :integer
# primary_us_citizen :integer default("unfilled"), not null
# primary_visa :integer default("unfilled"), not null
# product_year :integer not null
# receive_written_communication :integer default("unfilled"), not null
# received_advance_ctc_payment :integer
Expand Down Expand Up @@ -237,6 +238,7 @@
# spouse_suffix :string
# spouse_tin_type :integer
# spouse_us_citizen :integer default("unfilled"), not null
# spouse_visa :integer default("unfilled"), not null
# spouse_was_blind :integer default("unfilled"), not null
# spouse_was_full_time_student :integer default("unfilled"), not null
# state :string
Expand Down Expand Up @@ -381,6 +383,7 @@ class Intake::GyrIntake < Intake
enum paid_student_loan_interest: { unfilled: 0, yes: 1, no: 2, unsure: 3 }, _prefix: :paid_student_loan_interest
enum phone_number_can_receive_texts: { unfilled: 0, yes: 1, no: 2, unsure: 3 }, _prefix: :phone_number_can_receive_texts
enum primary_us_citizen: { unfilled: 0, yes: 1, no: 2 }, _prefix: :primary_us_citizen
enum primary_visa: { unfilled: 0, yes: 1, no: 2 }, _prefix: :primary_visa
enum received_alimony: { unfilled: 0, yes: 1, no: 2, unsure: 3 }, _prefix: :received_alimony
enum received_homebuyer_credit: { unfilled: 0, yes: 1, no: 2, unsure: 3 }, _prefix: :received_homebuyer_credit
enum received_irs_letter: { unfilled: 0, yes: 1, no: 2, unsure: 3 }, _prefix: :received_irs_letter
Expand All @@ -399,6 +402,7 @@ class Intake::GyrIntake < Intake
enum spouse_us_citizen: { unfilled: 0, yes: 1, no: 2 }, _prefix: :spouse_us_citizen
enum spouse_was_full_time_student: { unfilled: 0, yes: 1, no: 2 }, _prefix: :spouse_was_full_time_student
enum spouse_was_blind: { unfilled: 0, yes: 1, no: 2 }, _prefix: :spouse_was_blind
enum spouse_visa: { unfilled: 0, yes: 1, no: 2 }, _prefix: :spouse_visa
enum was_blind: { unfilled: 0, yes: 1, no: 2, unsure: 3 }, _prefix: :was_blind
enum was_full_time_student: { unfilled: 0, yes: 1, no: 2, unsure: 3 }, _prefix: :was_full_time_student
enum widowed: { unfilled: 0, yes: 1, no: 2 }, _prefix: :widowed
Expand Down
3 changes: 2 additions & 1 deletion app/views/questions/life_situations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<%= f.cfa_checkbox(:had_disability, t('views.questions.life_situations.options.had_disability'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:was_blind, t('views.questions.life_situations.options.was_blind'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:was_full_time_student, t('views.questions.life_situations.options.was_full_time_student'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:primary_not_us_citizen, t('views.questions.life_situations.options.was_not_citizen'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:primary_us_citizen, t('views.questions.life_situations.options.was_citizen'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:primary_visa, t('views.questions.life_situations.options.was_on_visa'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:no_life_situations_apply, t("general.none_of_the_above"), options: { id: "none__checkbox", checked_value: "yes", unchecked_value: "no" }) %>
</div>

Expand Down
3 changes: 2 additions & 1 deletion app/views/questions/spouse_life_situations/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<%= f.cfa_checkbox(:spouse_had_disability, t('views.questions.spouse_life_situations.options.had_disability'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:spouse_was_blind, t('views.questions.spouse_life_situations.options.was_blind'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:spouse_was_full_time_student, t('views.questions.spouse_life_situations.options.was_full_time_student'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:spouse_not_us_citizen, t('views.questions.spouse_life_situations.options.was_not_citizen'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:spouse_us_citizen, t('views.questions.spouse_life_situations.options.was_citizen'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:spouse_visa, t('views.questions.spouse_life_situations.options.was_on_visa'), options: { checked_value: "yes", unchecked_value: "no" }) %>
<%= f.cfa_checkbox(:no_life_situations_apply, t("general.none_of_the_above"), options: { id: "none__checkbox", checked_value: "yes", unchecked_value: "no" }) %>
</div>

Expand Down
6 changes: 4 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5967,8 +5967,9 @@ en:
options:
had_disability: I had a permanent disability
was_blind: I was legally blind
was_citizen: I was a US citizen
was_full_time_student: I was a full-time student in a college or a trade school
was_not_citizen: I was not a US citizen
was_on_visa: I was in the US on a visa
title: Select any situations that were true for you in %{year}
lived_with_spouse:
title: Did you live with your spouse during any part of the last six months of %{year}?
Expand Down Expand Up @@ -6125,8 +6126,9 @@ en:
options:
had_disability: They had a permanent disability
was_blind: They were legally blind
was_citizen: They were a US citizen
was_full_time_student: They were a full-time student in a college or a trade school
was_not_citizen: They were not a US citizen
was_on_visa: They were in the US on a visa
title: Select any situations that were true for your spouse in %{year}
ssn_itin:
title: Please provide your taxpayer identification information.
Expand Down
6 changes: 4 additions & 2 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5984,8 +5984,9 @@ es:
options:
had_disability: Yo tenía una discapacidad permanente
was_blind: Yo estaba legalmente ciego
was_citizen: Yo era ciudadano estadounidense
was_full_time_student: Yo era un estudiante a tiempo completo en una universidad o una escuela de oficios
was_not_citizen: No era ciudadano estadounidense
was_on_visa: Yo estaba en los Estados Unidos con visado
title: Seleccione las situaciones que fueron verdaderas para usted en el %{year}
lived_with_spouse:
title: "¿Vivió con su cónyuge durante alguna parte de los últimos seis meses de %{year}?"
Expand Down Expand Up @@ -6157,8 +6158,9 @@ es:
options:
had_disability: Mi cónyuge tenía una discapacidad permanente
was_blind: Mi cónyuge era legalmente ciego
was_citizen: Eran ciudadanos estadounidenses
was_full_time_student: Mi cónyuge era un estudiante a tiempo completo en una universidad o una escuela de oficios
was_not_citizen: No eran ciudadanos estadounidenses
was_on_visa: Mi cónyuge estaba en los Estados Unidos con visado
title: Seleccione cualquier situación que haya sido cierta para su cónyuge en %{year}
ssn_itin:
title: Favor de proporcionar su información de identificación del contribuyente, "taxpayer identification information" en inglés.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddPrimaryVisaAndSpouseVisaToGyrIntake < ActiveRecord::Migration[7.1]
def change
add_column :intakes, :primary_visa, :integer, default: 0, null: false
add_column :intakes, :spouse_visa, :integer, default: 0, null: false
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_12_18_013817) do
ActiveRecord::Schema[7.1].define(version: 2024_12_19_031602) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "plpgsql"
Expand Down Expand Up @@ -1324,6 +1324,7 @@
t.string "primary_suffix"
t.integer "primary_tin_type"
t.integer "primary_us_citizen", default: 0, null: false
t.integer "primary_visa", default: 0, null: false
t.integer "product_year", null: false
t.integer "receive_written_communication", default: 0, null: false
t.integer "received_advance_ctc_payment"
Expand Down Expand Up @@ -1380,6 +1381,7 @@
t.string "spouse_suffix"
t.integer "spouse_tin_type"
t.integer "spouse_us_citizen", default: 0, null: false
t.integer "spouse_visa", default: 0, null: false
t.integer "spouse_was_blind", default: 0, null: false
t.integer "spouse_was_full_time_student", default: 0, null: false
t.string "state"
Expand Down
2 changes: 1 addition & 1 deletion spec/features/web_intake/new_joint_filers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def intake_up_to_documents
check "I had a permanent disability"
check "I was legally blind"
check "I was a full-time student in a college or a trade school"
check "I was not a US citizen"
check "I was a US citizen"
end
click_on "Continue"

Expand Down
14 changes: 9 additions & 5 deletions spec/forms/life_situations_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{
had_disability: "no",
was_blind: "no",
primary_not_us_citizen: "no",
primary_us_citizen: "no",
primary_visa: "no",
was_full_time_student: "no",
no_life_situations_apply: "yes"
}
Expand All @@ -17,7 +18,8 @@
{
had_disability: "yes",
was_blind: "yes",
primary_not_us_citizen: "yes",
primary_us_citizen: "yes",
primary_visa: "yes",
was_full_time_student: "yes",
no_life_situations_apply: "no",
}
Expand All @@ -30,7 +32,8 @@
intake.reload

expect(intake.had_disability).to eq "no"
expect(intake.primary_us_citizen).to eq "yes"
expect(intake.primary_us_citizen).to eq "no"
expect(intake.primary_visa).to eq "no"
expect(intake.was_blind).to eq "no"
expect(intake.was_full_time_student).to eq "no"
end
Expand All @@ -41,10 +44,11 @@
intake.reload

expect(intake.had_disability).to eq "yes"
expect(intake.primary_us_citizen).to eq "no"
expect(intake.primary_us_citizen).to eq "yes"
expect(intake.primary_visa).to eq "yes"
expect(intake.was_blind).to eq "yes"
expect(intake.was_full_time_student).to eq "yes"
end
end

end
end
14 changes: 9 additions & 5 deletions spec/forms/spouse_life_situations_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{
spouse_had_disability: "no",
spouse_was_blind: "no",
spouse_not_us_citizen: "no",
spouse_us_citizen: "no",
spouse_visa: "no",
spouse_was_full_time_student: "no",
no_life_situations_apply: "yes",
}
Expand All @@ -17,7 +18,8 @@
{
spouse_had_disability: "yes",
spouse_was_blind: "yes",
spouse_not_us_citizen: "yes",
spouse_us_citizen: "yes",
spouse_visa: "yes",
spouse_was_full_time_student: "yes",
no_life_situations_apply: "no",
}
Expand All @@ -30,7 +32,8 @@
intake.reload

expect(intake.spouse_had_disability).to eq "no"
expect(intake.spouse_us_citizen).to eq "yes"
expect(intake.spouse_us_citizen).to eq "no"
expect(intake.spouse_visa).to eq "no"
expect(intake.spouse_was_blind).to eq "no"
expect(intake.spouse_was_full_time_student).to eq "no"
end
Expand All @@ -41,10 +44,11 @@
intake.reload

expect(intake.spouse_had_disability).to eq "yes"
expect(intake.spouse_us_citizen).to eq "no"
expect(intake.spouse_us_citizen).to eq "yes"
expect(intake.spouse_visa).to eq "yes"
expect(intake.spouse_was_blind).to eq "yes"
expect(intake.spouse_was_full_time_student).to eq "yes"
end
end

end
end
2 changes: 2 additions & 0 deletions spec/models/intake/gyr_intake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
# primary_suffix :string
# primary_tin_type :integer
# primary_us_citizen :integer default("unfilled"), not null
# primary_visa :integer default("unfilled"), not null
# product_year :integer not null
# receive_written_communication :integer default("unfilled"), not null
# received_advance_ctc_payment :integer
Expand Down Expand Up @@ -237,6 +238,7 @@
# spouse_suffix :string
# spouse_tin_type :integer
# spouse_us_citizen :integer default("unfilled"), not null
# spouse_visa :integer default("unfilled"), not null
# spouse_was_blind :integer default("unfilled"), not null
# spouse_was_full_time_student :integer default("unfilled"), not null
# state :string
Expand Down
2 changes: 2 additions & 0 deletions spec/models/intake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
# primary_suffix :string
# primary_tin_type :integer
# primary_us_citizen :integer default(0), not null
# primary_visa :integer default(0), not null
# product_year :integer not null
# receive_written_communication :integer default(0), not null
# received_advance_ctc_payment :integer
Expand Down Expand Up @@ -237,6 +238,7 @@
# spouse_suffix :string
# spouse_tin_type :integer
# spouse_us_citizen :integer default(0), not null
# spouse_visa :integer default(0), not null
# spouse_was_blind :integer default(0), not null
# spouse_was_full_time_student :integer default(0), not null
# state :string
Expand Down
Loading