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 logic surrounding case contacts with no reimbursements #5708

Conversation

yosefbennywidyo
Copy link
Contributor

What github issue is this PR for, if any?

Resolves #5666

What changed, and why?

Fix logic surrounding case contacts with no reimbursements

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 :)

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.

Screen Shot 2024-05-11 at 15 22 16

URL: http://localhost:3000/mileage_rates/

Screen Shot 2024-05-11 at 15 22 48

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

- Conditionally set case contact status to current step when:
    - Case contact is not active.
    - :case_contact parameter is present in the request.
- Simplified logic by removing unnecessary conditional block.
- Replaced `params.require(:case_contact)` with `params.fetch(:case_contact, {})`
  to gracefully handle cases where the :case_contact parameter is missing in the request.
- This prevents potential errors caused by calling `permit` on a non-existent hash.
- remove temporary fix to ensure something is always submitted
- fix fill_in Effective date field with correct date format: `dd/mm/yyyy`
@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 erb labels May 11, 2024
- Introduced `set_case_contact` filter for DRYness.
- Applied `set_case_contact` filter before `show` and `update` actions.
- Removed duplicate fetching of `@case_contact` in those actions.
@yosefbennywidyo yosefbennywidyo force-pushed the fix-logic-surroundin-case-contacts-with-no-reimbursements branch from ca31f6a to 57c08d7 Compare May 11, 2024 20:43
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.

:) !

@compwron compwron merged commit 031c94d into rubyforgood:main May 12, 2024
16 checks passed
@yosefbennywidyo yosefbennywidyo deleted the fix-logic-surroundin-case-contacts-with-no-reimbursements branch May 12, 2024 01:54
iamronakgupta added a commit to iamronakgupta/casa that referenced this pull request May 31, 2024
…ecause current PR removed expense step when both the expenses are disabled
elasticspoon added a commit that referenced this pull request Jun 9, 2024
* form_step method added in case_contact

* form steps are dynamically changed according to case_contact

* fixed standardrb lint

* Submit click removed as it is not available when expenses are disabled

* revert back parasm code of #5708 as it no longer crashes because current PR removed expense step when both the expenses are disabled

* save and continue button on notes page will changes to submit button if last step is notes

* notes page will have submit button instead of save and continue button when driving reimbursement and other expenses are disabled

* replaced CaseContact:FORM_STEPS with form_steps method

* casa_org_any_expenses_enabled? method added to check if casa_org has any expenses enabled

* form submit button component added

* replaced conditional logic with component for submit button

* form submit_button_component added

* method added for text conditional logic

* button_tag moved from notes to button componentd

* test cases fixed

* fixed standardrb lint

* fix: extra line added to fix erb-lint

* Update submit_button_component.html.erb

* fix: erb_lint submit button

---------

Co-authored-by: elasticspoon <[email protected]>
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.

Cleanup: fix logic surrounding case contacts with no reimbursements
2 participants