-
Notifications
You must be signed in to change notification settings - Fork 13
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
NJ 281 - Create new table to store NJ analytics #5537
Conversation
Heroku app: https://gyr-review-app-5537-2f85a9723a71.herokuapp.com/ |
} | ||
required_fields.each do |metric| | ||
if nj1040_fields[metric].nil? | ||
0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this 0
get assigned to the metabase_metrics
like what happens in the else
block? i.e.,
if nj1040_fields[metric].nil?
metabase_metrics[metric] = 0
else # ...
if so, could the whole thing be a single assignment like metabase_metrics[metric] = nj1040_fields[metric] || 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! Thank you for noticing this and sharing the one-liner!
db/schema.rb
Outdated
t.integer "NJ1040_LINE_12_COUNT", default: 0, null: false | ||
t.integer "NJ1040_LINE_15", default: 0, null: false | ||
t.integer "NJ1040_LINE_16A", default: 0, null: false | ||
t.integer "NJ1040_LINE_16B", default: 0, null: false | ||
t.integer "NJ1040_LINE_29", default: 0, null: false | ||
t.integer "NJ1040_LINE_31", default: 0, null: false | ||
t.integer "NJ1040_LINE_41", default: 0, null: false | ||
t.integer "NJ1040_LINE_42", default: 0, null: false | ||
t.integer "NJ1040_LINE_43", default: 0, null: false | ||
t.integer "NJ1040_LINE_51", default: 0, null: false | ||
t.integer "NJ1040_LINE_56", default: 0, null: false | ||
t.integer "NJ1040_LINE_58", default: 0, null: false | ||
t.integer "NJ1040_LINE_58_IRS", default: 0, null: false | ||
t.integer "NJ1040_LINE_59", default: 0, null: false | ||
t.integer "NJ1040_LINE_61", default: 0, null: false | ||
t.integer "NJ1040_LINE_64", default: 0, null: false | ||
t.integer "NJ1040_LINE_65", default: 0, null: false | ||
t.integer "NJ1040_LINE_65_DEPENDENTS", default: 0, null: false | ||
t.integer "NJ1040_LINE_7_SELF", default: 0, null: false | ||
t.integer "NJ1040_LINE_7_SPOUSE", default: 0, null: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these left over from an earlier form of the migration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Thank you for catching this! Will remove.
end | ||
end | ||
|
||
context "for not NJ" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love a good negative test. thank you for adding this.
app/models/intake/gyr_intake.rb
Outdated
@@ -397,8 +397,6 @@ | |||
# | |||
# fk_rails_... (client_id => clients.id) | |||
# fk_rails_... (matching_previous_year_intake_id => intakes.id) | |||
# fk_rails_... (primary_drivers_license_id => drivers_licenses.id) | |||
# fk_rails_... (spouse_drivers_license_id => drivers_licenses.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pebble] - I get these changes to intake model files sometimes locally too but I believe they can be ignored? Or can be a separate PR? But also I don't know their effects and if they are harmless then I'm also fine with merging... just want to flag to be sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the flag. Was seeing build failures previously if they weren't included, since the DB didn't match the schema. Let me investigate to see if they pop up again if these files are reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually a really useful comment! I had been recreating the db with bin/rails db:drop
and bin/rails db:prepare
, but didn't realize that it wasn't actually recreating the DB from scratch! This led to these fields being removed erroneously.
This time, I recreated the DB with the following 3 commands and things worked correctly:
bin/rails db:drop
bin/rails db:create
bin/rails db:migrate
Have updated our internal notes on how this works.
app/models/state_file_nj_intake.rb
Outdated
# NJ1040_LINE_65 :integer default(0), not null | ||
# NJ1040_LINE_65_DEPENDENTS :integer default(0), not null | ||
# NJ1040_LINE_7_SELF :integer default(0), not null | ||
# NJ1040_LINE_7_SPOUSE :integer default(0), not null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[potential boulder] - I'm having trouble following the addition of all these columns in both the intake and the analytics. Is there a limitation we have that we need to add both and can't make do with only the columns on the new analytics table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They shouldn't be in the intake! This is an artifact from the previous migration, which Jey called out and I am removing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a question that's keeping me from following how this works
0f0ec99
to
c40395c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stellar.
Link to pivotal/JIRA issue
Is PM acceptance required? (delete one)
Reminder: merge main into this branch and get green tests before merging to main
What was done?
Update calculator fields to make Blind/Disabled exemptions visible to analytics
Add new record for NJ analytics (so PMs can view the metrics for different lines on NJ1040)
Populate analytics records using async job after submission
TODO:
How to test?