-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
3351 add family archive #3623
3351 add family archive #3623
Conversation
* Updated the view, controller and test to use the new column * Added auto archive of children on families archive
* Added scope to Families with unit tests * Added default filter to families controller * Updated the CSV output on the families controller * Added `Include Archived?` option on the families view * Added request test to ensure default only returns the non-archived * Added test for `Include Archived?` check on index
b3155d1
to
1aa1f0b
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.
Thanks for the PR! Added some comments and suggestions.
* Extracted archiving the children of a family to a service object that is called in the family controller and took the funciton and callback off of the family model * Updated and added unit test * Updated the migration to remove backfill migration
I think I have addressed all of the changes, I might need to rebase but should be set |
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.
Getting closer! Had some more comments.
Thank you! I'll get on it |
updated it to module level function. I also updated the migration table to creat the column and set nill and default all on one line
I moved forward with all of the changes to the service class and the migration. I played around with updating the family controller for a while to make it work with bools but I did some investigation into filterrific and it when you pass in 'false' as a query parameter to filteriffic it translates that false to '0' and when you pass in |
@grantmca I'm not sure I understand this. Filterrific parameters get sent to the controller. The controller can make whatever changes it has to do to those parameters rather than passing them blindly to the service object or the model. I'd rather see those changes happen in the controller than downstream. |
I apologize for any confusion caused by my previous explanation. Here's a more detailed breakdown: the view sends either '0' or '1' as the params for the checkbox to the controller. Within the controller, I implemented and tested logic that cast this '0' or '1' to a boolean value and then pass this boolean to the 'filterrific' initializer. The gem 'filterrific' provides us with the service object @filterrific, and its method @filterrific.find receives the filterrific parameters from the controller. Using these parameters and a scope defined on the model, the method returns the desired results. However, there's is a catch: the "filterrific" service object performs some parameter data cleanup before passing the parameters to the model's scope. One such cleanup action is converting 'false' to 0 before passing it to the model's scope. Since the model's scope might expect a boolean value, this can lead to converting the scope just for it to be converted back to 0. I am open to any suggestions on how to best handle this case! Let me know if you need any further adjustments! |
I think the issue might be because it's using the string "false" instead of a Boolean |
I am sorry I should of used backticks instead of single quotes, I am passing the bool |
Please do, thanks. This behavior really doesn't make any sense. |
This seems to maybe be a bug on Filterfific's end. On this line you can see that in the |
So it looks like this is the suggested approach: jhund/filterrific#9 In general I'd try to keep the 0/1 check to a single place. If you have to massage the parameters to turn the 0/1 into true/false, I'd do it in a method or callback before any other methods are called. |
I went ahead and opened a PR for this on filterrific jhund/filterrific#224 @dorner let me know how we should proceed form here. |
@grantmca did you try this approach? jhund/filterrific#9 (comment) We could use that while we wait :) |
* Updated the view, controller and test to use the new column * Added auto archive of children on families archive
* Added scope to Families with unit tests * Added default filter to families controller * Updated the CSV output on the families controller * Added `Include Archived?` option on the families view * Added request test to ensure default only returns the non-archived * Added test for `Include Archived?` check on index
* Extracted archiving the children of a family to a service object that is called in the family controller and took the funciton and callback off of the family model * Updated and added unit test * Updated the migration to remove backfill migration
updated it to module level function. I also updated the migration table to creat the column and set nill and default all on one line
…51-add-family-archive
I think that we are all set now! @dorner, I updated the scope to follow the example on the issue you linked. Let me know what you think! |
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.
Probably as good as it's going to get - but I think there's a typo in the migration file?
Thanks for all your patience with this! In it goes! |
Checklist:
Resolves #3351
Description
Guide questions:
--The ability to archive families no longer use to help users not have to scroll through large list
--Increases usability for the user, provides additional info on reports
Type of change
How Has This Been Tested?
You can validate the change by switching some families to archived in the dev env and ensuring they do not show up by default, additionally check that any children associated with the families are also archived. Also validate that when "Include Archived" is checked that all families are shown on the index screen
Screenshots