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-609 Combine race ethnicity questions and add mena as demographic option #5210

Merged
Show file tree
Hide file tree
Changes from 11 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ class DemographicPrimaryEthnicityController < PostCompletionQuestionsController

layout "intake"

def self.show?(intake)
intake.demographic_questions_opt_in_yes?
end
def self.show?(intake) = false

def illustration_path; end

Expand Down
18 changes: 18 additions & 0 deletions app/controllers/questions/demographic_primary_race_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,23 @@ def self.show?(intake)
end

def illustration_path; end

def next_path
default_next_path = super
if default_next_path.nil?
root_path
else
default_next_path
end
end

private

def after_update_success
super
if next_path == root_path
clear_intake_session
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ class DemographicSpouseEthnicityController < PostCompletionQuestionsController

layout "intake"

def self.show?(intake)
if intake == nil
return false
end
intake.demographic_questions_opt_in_yes? && intake.filing_joint_yes?
end
def self.show?(intake) = false

def illustration_path; end

Expand Down
15 changes: 14 additions & 1 deletion app/controllers/questions/demographic_spouse_race_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ class DemographicSpouseRaceController < PostCompletionQuestionsController
layout "intake"

def self.show?(intake)
intake.demographic_questions_opt_in_yes? && intake.filing_joint_yes?
intake&.demographic_questions_opt_in_yes? && intake&.filing_joint_yes?
end

def illustration_path; end

private

def next_path
root_path
end

def after_update_success
super
if next_path == root_path
clear_intake_session
end
end
end
end
3 changes: 2 additions & 1 deletion app/forms/demographic_primary_race_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class DemographicPrimaryRaceForm < QuestionsForm
set_attributes_for :intake,
:demographic_primary_american_indian_alaska_native,
:demographic_primary_black_african_american,
:demographic_primary_mena,
:demographic_primary_native_hawaiian_pacific_islander,
:demographic_primary_asian,
:demographic_primary_white,
Expand All @@ -17,4 +18,4 @@ def save
end
@intake.update(attributes)
end
end
end
3 changes: 2 additions & 1 deletion app/forms/demographic_spouse_race_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class DemographicSpouseRaceForm < QuestionsForm
set_attributes_for :intake,
:demographic_spouse_american_indian_alaska_native,
:demographic_spouse_black_african_american,
:demographic_spouse_mena,
:demographic_spouse_native_hawaiian_pacific_islander,
:demographic_spouse_asian,
:demographic_spouse_white,
Expand All @@ -16,4 +17,4 @@ def save
end
@intake.update(attributes)
end
end
end
2 changes: 0 additions & 2 deletions app/lib/navigation/gyr_question_navigation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ class GyrQuestionNavigation
Questions::DemographicVeteranController,
Questions::DemographicPrimaryRaceController,
Questions::DemographicSpouseRaceController,
Questions::DemographicPrimaryEthnicityController,
Questions::DemographicSpouseEthnicityController,
].freeze
end
end
2 changes: 2 additions & 0 deletions app/models/intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
# demographic_primary_asian :boolean
# demographic_primary_black_african_american :boolean
# demographic_primary_ethnicity :integer default(0), not null
# demographic_primary_mena :boolean
# demographic_primary_native_hawaiian_pacific_islander :boolean
# demographic_primary_prefer_not_to_answer_race :boolean
# demographic_primary_white :boolean
Expand All @@ -48,6 +49,7 @@
# demographic_spouse_asian :boolean
# demographic_spouse_black_african_american :boolean
# demographic_spouse_ethnicity :integer default(0), not null
# demographic_spouse_mena :boolean
# demographic_spouse_native_hawaiian_pacific_islander :boolean
# demographic_spouse_prefer_not_to_answer_race :boolean
# demographic_spouse_white :boolean
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 @@ -39,6 +39,7 @@
# demographic_primary_asian :boolean
# demographic_primary_black_african_american :boolean
# demographic_primary_ethnicity :integer default(0), not null
# demographic_primary_mena :boolean
# demographic_primary_native_hawaiian_pacific_islander :boolean
# demographic_primary_prefer_not_to_answer_race :boolean
# demographic_primary_white :boolean
Expand All @@ -48,6 +49,7 @@
# demographic_spouse_asian :boolean
# demographic_spouse_black_african_american :boolean
# demographic_spouse_ethnicity :integer default(0), not null
# demographic_spouse_mena :boolean
# demographic_spouse_native_hawaiian_pacific_islander :boolean
# demographic_spouse_prefer_not_to_answer_race :boolean
# demographic_spouse_white :boolean
Expand Down
2 changes: 2 additions & 0 deletions app/models/intake/gyr_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
# demographic_primary_asian :boolean
# demographic_primary_black_african_american :boolean
# demographic_primary_ethnicity :integer default("unfilled"), not null
# demographic_primary_mena :boolean
# demographic_primary_native_hawaiian_pacific_islander :boolean
# demographic_primary_prefer_not_to_answer_race :boolean
# demographic_primary_white :boolean
Expand All @@ -48,6 +49,7 @@
# demographic_spouse_asian :boolean
# demographic_spouse_black_african_american :boolean
# demographic_spouse_ethnicity :integer default("unfilled"), not null
# demographic_spouse_mena :boolean
# demographic_spouse_native_hawaiian_pacific_islander :boolean
# demographic_spouse_prefer_not_to_answer_race :boolean
# demographic_spouse_white :boolean
Expand Down
3 changes: 2 additions & 1 deletion app/views/questions/demographic_primary_race/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
<%= f.cfa_checkbox(:demographic_primary_native_hawaiian_pacific_islander, t("general.race.native_hawaiian_pacific_islander"), options: { checked_value: true, unchecked_value: false }) %>
<%= f.cfa_checkbox(:demographic_primary_asian, t("general.race.asian"), options: { checked_value: true, unchecked_value: false }) %>
<%= f.cfa_checkbox(:demographic_primary_black_african_american, t("general.race.black_african_american"), options: { checked_value: true, unchecked_value: false }) %>
<%= f.cfa_checkbox(:demographic_primary_mena, t("general.race.mena"), options: { checked_value: true, unchecked_value: false }) %>
<%= f.cfa_checkbox(:demographic_primary_white, t("general.race.white"), options: { checked_value: true, unchecked_value: false }) %>
</div>

<%= f.continue %>
<%= f.continue Questions::DemographicSpouseRaceController.show?(current_intake) ? t("general.continue") : t("general.submit") %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: next_path == root_path might be a simpler boolean test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<%= f.button :submit, name: "#{f.object_name}[demographic_primary_prefer_not_to_answer_race]", value: true, class: "button button--wide", "aria-describedby": "demographic_primary_race_question" do %>
<%=t("general.skip_question") %>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions app/views/questions/demographic_spouse_race/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<%= f.cfa_checkbox(:demographic_spouse_native_hawaiian_pacific_islander, t("general.race.native_hawaiian_pacific_islander"), options: { checked_value: true, unchecked_value: false }) %>
<%= f.cfa_checkbox(:demographic_spouse_asian, t("general.race.asian"), options: { checked_value: true, unchecked_value: false }) %>
<%= f.cfa_checkbox(:demographic_spouse_black_african_american, t("general.race.black_african_american"), options: { checked_value: true, unchecked_value: false }) %>
<%= f.cfa_checkbox(:demographic_spouse_mena, t("general.race.mena"), options: { checked_value: true, unchecked_value: false }) %>
<%= f.cfa_checkbox(:demographic_spouse_white, t("general.race.white"), options: { checked_value: true, unchecked_value: false }) %>
</div>

Expand Down
5 changes: 3 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ en:
american_indian_alaska_native: American Indian or Alaska Native
asian: Asian
black_african_american: Black or African American
mena: Middle Eastern or North African
native_hawaiian_pacific_islander: Native Hawaiian or other Pacific Islander
white: White
register: Sign Up
Expand Down Expand Up @@ -5900,13 +5901,13 @@ en:
demographic_primary_ethnicity:
title: What is your ethnicity?
demographic_primary_race:
title: What is your race?
title: What is your race and/or ethnicity?
demographic_questions:
title: Are you willing to answer some additional questions to help us better serve you?
demographic_spouse_ethnicity:
title: What is your spouse's ethnicity?
demographic_spouse_race:
title: What is your spouse's race?
title: What is your spouse's race and/or ethnicity?
demographic_veteran:
title: Are you or your spouse a veteran of the U.S. Armed Forces?
dependent_care:
Expand Down
5 changes: 3 additions & 2 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ es:
american_indian_alaska_native: Indio Americano o Nativo de Alaska
asian: Asiático
black_african_american: Negro o afroamericano
mena: Oriente Medio o norteafricano
native_hawaiian_pacific_islander: Nativo de Hawái u otra isla del Pacífico
white: Blanco
register: Regístrate
Expand Down Expand Up @@ -5898,13 +5899,13 @@ es:
demographic_primary_ethnicity:
title: Cuál es tu etnicidad?
demographic_primary_race:
title: "¿Cuál es su raza?"
title: "¿Cuál es su raza y/o grupo étnico?"
demographic_questions:
title: "¿Está dispuesto a responder algunas preguntas adicionales para ayudarnos a servirle mejor?"
demographic_spouse_ethnicity:
title: "¿Cuál es el origen étnico de su cónyuge?"
demographic_spouse_race:
title: "¿Cuál es la raza de tu cónyuge?"
title: "¿Cuál es la raza y/o grupo étnico de tu cónyuge?"
demographic_veteran:
title: "¿Es usted o su cónyuge veterano de las Fuerzas Armadas de los EE. UU.?"
dependent_care:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddDemographicPrimaryMenaToIntakes < ActiveRecord::Migration[7.1]
def change
add_column :intakes, :demographic_primary_mena, :boolean
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddDemographicSpouseMenaToIntakes < ActiveRecord::Migration[7.1]
def change
add_column :intakes, :demographic_spouse_mena, :boolean
end
end
2 changes: 2 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@
t.boolean "demographic_primary_asian"
t.boolean "demographic_primary_black_african_american"
t.integer "demographic_primary_ethnicity", default: 0, null: false
t.boolean "demographic_primary_mena"
t.boolean "demographic_primary_native_hawaiian_pacific_islander"
t.boolean "demographic_primary_prefer_not_to_answer_race"
t.boolean "demographic_primary_white"
Expand All @@ -1187,6 +1188,7 @@
t.boolean "demographic_spouse_asian"
t.boolean "demographic_spouse_black_african_american"
t.integer "demographic_spouse_ethnicity", default: 0, null: false
t.boolean "demographic_spouse_mena"
t.boolean "demographic_spouse_native_hawaiian_pacific_islander"
t.boolean "demographic_spouse_prefer_not_to_answer_race"
t.boolean "demographic_spouse_white"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require "rails_helper"

RSpec.describe Questions::DemographicPrimaryEthnicityController do
describe "#update" do
# Skip for TY2024
xdescribe "#update" do
context "with valid params" do
let(:params) do
{
Expand Down Expand Up @@ -37,7 +38,8 @@
end
end

describe 'next_path' do
# Skip for TY2024
xdescribe 'next_path' do
let(:intake) { create :intake, demographic_questions_opt_in: "yes", filing_joint: filing_joint }

before { sign_in intake.client }
Expand All @@ -56,4 +58,4 @@
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require "rails_helper"

RSpec.describe Questions::DemographicSpouseEthnicityController do
describe "#update" do
# Disable for TY2024
xdescribe "#update" do
context "with valid params" do
let(:params) do
{
Expand Down
14 changes: 2 additions & 12 deletions spec/features/web_intake/new_joint_filers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -578,25 +578,15 @@ def intake_up_to_documents
end
click_on "Continue"
screenshot_after do
expect(page).to have_selector("h1", text: "What is your race?")
expect(page).to have_selector("h1", text: "What is your race and/or ethnicity?")
check "White"
end
click_on "Continue"
screenshot_after do
expect(page).to have_selector("h1", text: "What is your spouse's race?")
expect(page).to have_selector("h1", text: "What is your spouse's race and/or ethnicity?")
check "White"
end
click_on "Continue"
screenshot_after do
expect(page).to have_text("What is your ethnicity?")
choose "Not Hispanic or Latino"
end
click_on "Continue"
screenshot_after do
expect(page).to have_text("What is your spouse's ethnicity?")
choose "Not Hispanic or Latino"
end
click_on "Continue"
end

context "client is included in the expanded id experiment", js: true do
Expand Down
7 changes: 2 additions & 5 deletions spec/features/web_intake/new_single_filer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,19 +442,16 @@ def intake_after_triage_up_to_documents(intake)
choose "Yes"
click_on "Continue"
expect(intake.reload.current_step).to end_with("/questions/demographic-primary-race")
expect(page).to have_selector("h1", text: "What is your race?")
expect(page).to have_selector("h1", text: "What is your race and/or ethnicity?")
check "Asian"
check "White"
click_on "Continue"
expect(page).to have_text("What is your ethnicity?")
choose "Not Hispanic or Latino"
click_on "Submit"

expect(page).to have_selector("h1", text: "Free tax filing")

# going back to another page after submit redirects to client login, does not reset current_step
visit "/questions/work-situations"
expect(intake.reload.current_step).to end_with("/questions/demographic-primary-ethnicity")
expect(intake.reload.current_step).to end_with("/questions/demographic-primary-race")
expect(page).to have_selector("h1", text: I18n.t("portal.client_logins.new.title"))
end
end
Expand Down
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 @@ -39,6 +39,7 @@
# demographic_primary_asian :boolean
# demographic_primary_black_african_american :boolean
# demographic_primary_ethnicity :integer default("unfilled"), not null
# demographic_primary_mena :boolean
# demographic_primary_native_hawaiian_pacific_islander :boolean
# demographic_primary_prefer_not_to_answer_race :boolean
# demographic_primary_white :boolean
Expand All @@ -48,6 +49,7 @@
# demographic_spouse_asian :boolean
# demographic_spouse_black_african_american :boolean
# demographic_spouse_ethnicity :integer default("unfilled"), not null
# demographic_spouse_mena :boolean
# demographic_spouse_native_hawaiian_pacific_islander :boolean
# demographic_spouse_prefer_not_to_answer_race :boolean
# demographic_spouse_white :boolean
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 @@ -39,6 +39,7 @@
# demographic_primary_asian :boolean
# demographic_primary_black_african_american :boolean
# demographic_primary_ethnicity :integer default(0), not null
# demographic_primary_mena :boolean
# demographic_primary_native_hawaiian_pacific_islander :boolean
# demographic_primary_prefer_not_to_answer_race :boolean
# demographic_primary_white :boolean
Expand All @@ -48,6 +49,7 @@
# demographic_spouse_asian :boolean
# demographic_spouse_black_african_american :boolean
# demographic_spouse_ethnicity :integer default(0), not null
# demographic_spouse_mena :boolean
# demographic_spouse_native_hawaiian_pacific_islander :boolean
# demographic_spouse_prefer_not_to_answer_race :boolean
# demographic_spouse_white :boolean
Expand Down
Loading