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

Fix: The first part of the new Casa Case form does not save certain input on error #5785

Merged
merged 7 commits into from
May 28, 2024

Conversation

iamronakgupta
Copy link
Contributor

What github issue is this PR for, if any?

Resolves #5760

What changed, and why?

Fixed values for "I don't know court date" and contact types all get cleared when there is error in form

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

Note: if you see a flake in your test build in github actions, please post in slack #casa "Flaky test: " :) 💪
Note: We love capybara tests! If you are writing both haml/js and ruby, please try to test your work with tests at every level including system tests like https://github.com/rubyforgood/casa/tree/main/spec/system

Screenshots please :)

image

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)

@github-actions github-actions bot added ruby Pull requests that update Ruby code erb labels May 28, 2024
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.

We have tests for this view https://github.com/rubyforgood/casa/blob/d539d06d8b3e1a07dec148be270ff7c1403e2d84/spec/system/casa_cases/new_spec.rb

I would love if you could add the small modification you made to one of the specs that checks for errors to ensure we don't have a regression in the future 🙂

@@ -54,6 +54,8 @@ def create
format.json { render json: @casa_case, status: :created }
end
else
set_contact_types
@empty_court_date = params[:casa_case][:empty_court_date] == "1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use the helper court_date_unknown? instead.

@iamronakgupta
Copy link
Contributor Author

We have tests for this view https://github.com/rubyforgood/casa/blob/d539d06d8b3e1a07dec148be270ff7c1403e2d84/spec/system/casa_cases/new_spec.rb

I would love if you could add the small modification you made to one of the specs that checks for errors to ensure we don't have a regression in the future 🙂

I did some modification, please review

@elasticspoon
Copy link
Collaborator

@iamronakgupta 1 last small thing. If I set the @empty_court_date via checkbox and there is an error the value for the check is being preserved BUT the date picker still shows.

image

The checkbox being ticked should hide the date picker.

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.

LGTM!

@compwron compwron changed the title Fix 5760 Fix: The first part of the new Casa Case form does not save certain input on error May 28, 2024
@elasticspoon elasticspoon merged commit 08868ee into rubyforgood:main May 28, 2024
19 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.

New Casa Case form not fields not saving on error
3 participants