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

FYST-792: ID Grocery Credit #4897

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1f5edf5
wip
mrotondo Oct 22, 2024
2369a7f
revert accidental change
mrotondo Oct 22, 2024
b9b7786
remove unused household_members list
mrotondo Oct 22, 2024
4f62674
fix mis-indented divs
mrotondo Oct 22, 2024
923d643
Add toggle-able primary and dep months to id grocery
squanto Oct 22, 2024
039518f
Add migration for grocery months id
squanto Oct 22, 2024
036e43d
adds primary and spouse to IdGroceryCreditForm
Oct 22, 2024
925d2f6
Merge branch 'main' into FYST-792-id-grocery-credit
Oct 23, 2024
c7a22ff
Merge branch 'main' into FYST-792-id-grocery-credit
Oct 23, 2024
610fae2
small cleanup to form
Oct 23, 2024
f8b1361
update intake and dependents and get page to render previous answers
mrotondo Oct 24, 2024
e6c7050
missed some annotate output after adding enums
mrotondo Oct 24, 2024
9930e40
added calculation for line 43, added some validations, and started wo…
mrotondo Oct 25, 2024
8333df5
refinements to calculator, xml & pdf output, more tests, more review …
mrotondo Oct 25, 2024
c8f0de1
add donate warning notice
mrotondo Oct 25, 2024
b41bb7b
checkbox styling
mrotondo Oct 25, 2024
ad2a8dd
try modifying question-with-follow-up to handle our use cases
mrotondo Oct 25, 2024
e34b975
page style and contents
mrotondo Oct 26, 2024
ff426ae
fix efile error spec
mrotondo Oct 26, 2024
fd42213
Merge branch 'main' into FYST-792-id-grocery-credit
mrotondo Oct 26, 2024
bee9d71
fix Idaho complete intake spec
mrotondo Oct 26, 2024
f44ae01
make change to synchronize dependents only apply to specific trait fo…
mrotondo Oct 26, 2024
7ec2069
remove todo we did
mrotondo Oct 28, 2024
3e52f03
move checkbox and ul styles into statefile stylesheet
mrotondo Oct 29, 2024
aa30894
add and use a household_count method on statefile base intake
mrotondo Oct 29, 2024
a878553
fix some bugs with grocery credit calculation, and simplify the test …
mrotondo Oct 30, 2024
9e99260
added form tests and fixed another bug
mrotondo Oct 30, 2024
4f3a7e8
remove accidental whitespace
mrotondo Oct 30, 2024
59e05b6
Merge remote-tracking branch 'origin/main' into FYST-792-id-grocery-c…
Oct 30, 2024
26f771f
simplify list styles, while still needing to use an additional class …
mrotondo Oct 30, 2024
2e24471
a few additional expectations for thoroughness
mrotondo Oct 30, 2024
950cb1c
use new senior? helpers on intake instead of doing age math, and make…
mrotondo Oct 30, 2024
bebfdee
use .and_call_original for default stub instead of returning nil
mrotondo Oct 30, 2024
57f82fa
calculator changes mostly
mrotondo Oct 30, 2024
d2576c3
Filter ineligible months for unchecked deps
squanto Oct 25, 2024
707ee52
check if household has grocery credit ineligible months before subtra…
mrotondo Oct 31, 2024
b9eefcf
set follow-up answers to no/nil in the form if the household answer i…
mrotondo Oct 31, 2024
94f724e
fix Idaho complete intake test by creating a DF json for the 'old sam…
mrotondo Oct 31, 2024
5c2658f
add a default json to the idaho intake factory, alongside the default…
mrotondo Oct 31, 2024
4c2f870
allow direct file json to be written the same way we do the xml, and …
mrotondo Nov 1, 2024
dcc7ba1
add tests for json_writer
mrotondo Nov 1, 2024
ab573cd
fix bug by changing to_s to to_json, and another one by only overwrit…
mrotondo Nov 1, 2024
5cda731
check pdf signature dates in the states' local time zones
mrotondo Nov 1, 2024
29c68e1
fix test of missing values (which should never be missing) by forcing…
mrotondo Nov 1, 2024
5933898
Merge branch 'refs/heads/main' into FYST-792-id-grocery-credit
mpidcock Nov 4, 2024
c8d4b83
Remove invalid follow ups when there are no inelegible grocery credits
Nov 6, 2024
15c6ce9
Fix bug for invalid follow ups in the grocery credit form
Nov 6, 2024
97d5804
Merge honeycrisp updates with changes for nested follow ups
Nov 6, 2024
892e5b6
WIP: expost intake bug and question when follow ups are deselected
Nov 6, 2024
3fe82bc
simplify changes to honeycrisp
mrotondo Nov 7, 2024
a534bea
disable followups by default, handle selects as well as inputs when e…
mrotondo Nov 7, 2024
26d9aac
restore & unbreak complete intake spec, and add new feature test to v…
mrotondo Nov 7, 2024
39c616f
fix bug in grocery credit form param handling and remove default 0 fr…
mrotondo Nov 7, 2024
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
20 changes: 20 additions & 0 deletions app/assets/stylesheets/_state-file.scss
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,22 @@
}
}

.tight-checkboxes {
.checkbox {
min-height: auto;
padding-top: 0;
padding-bottom: 0;
}

.checkbox input[type='checkbox'] {
top: 0.25rem;
}

.form-group {
margin-bottom: 1.5rem;
}
}

.radio-button {
border: none;
background-color: transparent;
Expand Down Expand Up @@ -273,6 +289,10 @@
padding-left: 1.5rem;
}

.list--bulleted-indented {
padding-left: 2.5rem;
}

.money-input-form-group {

.money-input-group {
Expand Down
25 changes: 24 additions & 1 deletion app/controllers/state_file/questions/df_return_sample.json
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
{}
{
"familyAndHousehold": [
{
"firstName": "Tessa",
"middleInitial": null,
"lastName": "Testerson",
"dateOfBirth": "2000-01-01",
"relationship": "daughter",
"eligibleDependent": true,
"isClaimedDependent": true,
"tin": "555-00-4444"
}
],
"filers": [
{
"firstName": "Testy",
"middleInitial": null,
"lastName": "Testerson",
"dateOfBirth": "1980-01-01",
"isPrimaryFiler": true,
"tin": "555-00-2222"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module StateFile
module Questions
class IdGroceryCreditController < QuestionsController
def self.show?(intake)
!intake.direct_file_data.claimed_as_dependent?
end

private

def form_params
params
.require(: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] }])
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module StateFile
module Questions
class IdGroceryCreditReviewController < QuestionsController
include ReturnToReviewConcern

def grocery_credit_amount
current_intake.calculator.grocery_credit_amount
end
helper_method :grocery_credit_amount

def self.show?(intake)
!intake.direct_file_data.claimed_as_dependent?
end
end
end
end
99 changes: 99 additions & 0 deletions app/forms/state_file/id_grocery_credit_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
module StateFile
class IdGroceryCreditForm < QuestionsForm
attr_accessor :dependents_attributes
delegate :dependents, to: :intake

set_attributes_for(
:intake,
:household_has_grocery_credit_ineligible_months,
:primary_has_grocery_credit_ineligible_months,
:spouse_has_grocery_credit_ineligible_months,
:primary_months_ineligible_for_grocery_credit,
:spouse_months_ineligible_for_grocery_credit
)

validates :household_has_grocery_credit_ineligible_months, inclusion: { in: %w[yes no], message: :blank }

validates :primary_months_ineligible_for_grocery_credit,
numericality: {
greater_than_or_equal_to: 0,
message: :blank
},
if: -> { primary_has_grocery_credit_ineligible_months == "yes" }
validates :spouse_months_ineligible_for_grocery_credit,
numericality: {
greater_than_or_equal_to: 0,
message: :blank
},
if: -> { spouse_has_grocery_credit_ineligible_months == "yes" }
arinchoi03 marked this conversation as resolved.
Show resolved Hide resolved

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

def save
@intake.update!(attributes_to_save)
end

def attributes_to_save
base_attrs = attributes_for(:intake)
base_attrs.merge({ dependents_attributes: dependents_attributes.to_h })
end

def valid?
dependents_valid = dependents.map { |d| d.valid?(:id_grocery_credit_form) }
super && dependents_valid.all?
end

def remove_invalid_followups(params)
modified_dependents_attributes = params[:dependents_attributes].to_h

modified_dependents_attributes = modified_dependents_attributes.select do |_, v|
v.key?(:id)
end

# set household member "has months" answers to no if household "has months" answer is no
if params[:household_has_grocery_credit_ineligible_months] == 'no'
params[:primary_has_grocery_credit_ineligible_months] = 'no'
params[:spouse_has_grocery_credit_ineligible_months] = 'no'
modified_dependents_attributes = modified_dependents_attributes.to_h do |k, v|
if v.key?(:id_has_grocery_credit_ineligible_months)
[k, v.merge(id_has_grocery_credit_ineligible_months: 'no')]
else
[k, v]
end
end
end

# set household months to nil/0 if their "has months" answer is no
if params[:primary_has_grocery_credit_ineligible_months] == 'no'
params[:primary_months_ineligible_for_grocery_credit] = ''
end
if params[:spouse_has_grocery_credit_ineligible_months] == 'no'
params[:spouse_months_ineligible_for_grocery_credit] = ''
end

modified_dependents_attributes = modified_dependents_attributes.to_h do |k, v|
credit_count_key = v.key?(:id_months_ineligible_for_grocery_credit)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we call this has_credit_count_key to be more clear

has_matching_no = modified_dependents_attributes.any? do |_, v2|
v[:id] == v2[:id] && v2[:id_has_grocery_credit_ineligible_months] == 'no'
end
arinchoi03 marked this conversation as resolved.
Show resolved Hide resolved
if credit_count_key && has_matching_no
[k, v.merge(id_months_ineligible_for_grocery_credit: '')]
else
[k, v]
end
end

params[:dependents_attributes] = modified_dependents_attributes

params
end
end
end
11 changes: 11 additions & 0 deletions app/forms/state_file/id_grocery_credit_review_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module StateFile
class IdGroceryCreditReviewForm < QuestionsForm
set_attributes_for :intake, :donate_grocery_credit

validates :donate_grocery_credit, inclusion: { in: %w[yes no], message: :blank }

def save
@intake.update(attributes_for(:intake))
end
end
end
Loading
Loading