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

Case contacts contact made default yes #6023

Conversation

DariusPirvulescu
Copy link
Contributor

What github issue is this PR for, if any?

Resolves #6016

What changed, and why?

This changes the default value for the contact_made column to true. This was done via a migration. Please let me know if that's alright or if we should do it via helpers and change the radio_button checked value.

I'm still learning and I am very much open to suggestions.

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

One of the specs was testing if @case_contact.contact_made was blank/false. With this change, the case_contact column will be true so the test failed. I removed this attribute from the tests as with the new migration, it is not the case for it to be blank.

Screenshots please :)

Run your local server and take a screenshot of your work! Try to include the URL of the page as well as the contents of the page.
6016

Feelings gif (optional)

What gif best describes your feeling working on this issue? https://giphy.com/
How to embed:

![alt text](https://media.giphy.com/media/1nP7ThJFes5pgXKUNf/giphy.gif)

alt text

@elasticspoon
Copy link
Collaborator

I think I would rather we do the change via that helper method that you pointed out.

The logic being, typically the data base schema essentially outlines the "axioms" or fundamental truth of the application (ex: a user can only belong to one organization, case contact must belong to a case).

In this case I would consider the default to be more of "business" logic. This is what the users want at the moment and they might just want it to change again in the future, we have no reason to tie ourselves to that decision. Thus, its better to do it in the ruby code and that helper looks like a great place for it.

@github-actions github-actions bot added the erb label Sep 6, 2024
@DariusPirvulescu
Copy link
Contributor Author

DariusPirvulescu commented Sep 6, 2024

Thanks for the help.
What if we create a CaseContact instance and set the contact_made: true?
This will remove the need for the set_contact_made_false helper and its tests.
(I pushed the commits for this)

Previously, the set_contact_made_false helper checked if case_contact.persisted?, but it always persisted as we created the instance beforehand.

Please let me know what you think of this solution :)

Copy link
Collaborator

@elasticspoon elasticspoon left a comment

Choose a reason for hiding this comment

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

Small bit of feedback but overall LGTM! Thanks!

app/views/case_contacts/form/details.html.erb Outdated Show resolved Hide resolved
@elasticspoon elasticspoon merged commit 4d3bf27 into rubyforgood:main Sep 7, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erb ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make "a. Was contact made?" defaulted to "Yes" on Case Contact Form
2 participants