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

[#1759] Remove transition_aged_youth column from CSV file when importing a case #1774

Conversation

rhian-cs
Copy link
Contributor

What github issue is this PR for, if any?

Resolves #1759

What changed, and why?

When an admin imports Cases from a CSV file, they no longer have to (or can) specify the transition_aged_youth column.

When importing a case from a CSV file, transition_aged_youth is now calculated by checking if the youth is 14 years old or older.

The reference casa_cases.csv from the imports page has been updated and the column has been removed.

How will this affect user permissions?

  • Admin permissions: They can no longer specify a value for transition_aged_youth when importing a case from a CSV file, since it is now calculated automatically.

How is this tested? (please write tests!) 💖💪

Since this is a minor change, I only updated the existing tests and fixtures.

In the casa_cases.csv fixture I changed the birth_month_year_youth of one of the cases from 2014 to 2000, so we could test both values of transition_aged_youth.

Screenshots please :)

Nothing in the UI was changed, but here is a screenshot of the sample CSV file before and after the change.

Before

before

After

after

@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Feb 22, 2021
@@ -18,13 +18,13 @@
expect { case_importer.import_cases }.to change(CasaCase, :count).by(3)

# correctly imports true/false transition_aged_youth
expect(CasaCase.find_by(case_number: "CINA-01-4347").transition_aged_youth).to be_truthy
expect(CasaCase.find_by(case_number: "CINA-01-4348").transition_aged_youth).to be_falsey
expect(CasaCase.find_by(case_number: "CINA-01-4347").transition_aged_youth).to be_falsey # birth_month_year_youth is nil

Choose a reason for hiding this comment

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

If you don't expect to have this field anymore, you could remove this expect or change it to be_nil that corresponds better to the expectation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I generally prefer that we follow https://www.betterspecs.org/ but as long as the linter likes it, I'm ok with it.

Copy link
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

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

Very cool! :) ✨🙌

@compwron compwron merged commit 43345d6 into rubyforgood:main Feb 22, 2021
@rhian-cs rhian-cs deleted the 1759-remove-transition-aged-youth_column-from-case-import-csv branch May 27, 2021 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove transition_aged_youth column from case import .csv
3 participants