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

Filter pets by fostered on staff pet view #795

Open
1 task
mononoken opened this issue Jun 1, 2024 · 4 comments
Open
1 task

Filter pets by fostered on staff pet view #795

mononoken opened this issue Jun 1, 2024 · 4 comments
Labels
help wanted Extra attention is needed Ready Make a comment to get assigned.

Comments

@mononoken
Copy link
Collaborator

Description

On the staff pets view, /staff/pets, we cannot filter pets by if they are fosterable or fostered. Currently, they only show "adopted" and "unadopted".

These filters work with ransack, and they may benefit from being reworked from their current state.

I haven't fully thought through this. If you have suggestions, let's think about how this works and make a clearer idea of what these options should be and what their names on the UI should be.

The cases desired to show:

  • Pets who can be adopted but are not
  • Pets that are adopted
  • Pets who can be fostered but are not
  • Pets that are fostered

Acceptance criteria

  • Filter pets by all of the cases described
@meg-gutshall meg-gutshall self-assigned this Jun 1, 2024
@meg-gutshall
Copy link
Member

Ideas for Desired Filters

  • Pets who can be adopted but are not --> Adoptable
  • Pets that are adopted --> Adoptions
  • Pets who can be fostered but are not --> Fosterable
  • Pets that are currently or are schedule to be fostered --> Fosters

I would like to implement more granular filters like the following:

  • Pets that are fostered --> Current Fosters
  • Pets that were previously fostered --> Completed Fosters
  • Pets that are scheduled to be fostered --> Pending Fosters

It feels like this would require a change in design for the Match model, or at the very least implementing a state machine. Personally, I think the Match model would be better off as a parent class to Adoption and Foster models. It can contain shared behavior and logic while the child classes handle more specific functionality.

This is mainly driven by the foster_statuses method on the Match model. There are more options that should be added to this list of statuses. There are also statuses that should be considered for adoptable pets too, which we can convert into filters.

@meg-gutshall
Copy link
Member

Thanks @kasugaijin for removing the assigned label. I got way too busy when I came home to finish this up.

For anyone who wants to pick this up, the WIP code is in branch 795-add-pet-filters. The custom Ransackers aren't working at the moment (the case statement methods). I think it may be because the case statement is checking for an integer when the params would be passing a string to the method.

That would be a good place to pick back up on this issue. Ping me with any questions!

@kasugaijin kasugaijin added the help wanted Extra attention is needed label Jun 12, 2024
@kasugaijin kasugaijin added the Ready Make a comment to get assigned. label Aug 23, 2024
@coalest
Copy link
Contributor

coalest commented Oct 5, 2024

I could take this issue on 🙋

Out of all the filters mentioned by @meg-gutshall, the only one that looks like it would be more effort to implement is the "Completed Fosters" filter (if this would return all pets that were fostered in their past, regardless of their current status). This seems like it would require an additional table for recording adoption/fostering history.

Should we create this kind of pet adoption status history table, or for now just provide all the filters that don't require information on a pet's previous state?

@kasugaijin
Copy link
Collaborator

kasugaijin commented Oct 5, 2024

Hey @coalest I have some thoughts here - let me know what you think
https://www.loom.com/share/9a2d70c4825b4754874d968a230b0932?sid=d6636dba-8f06-4342-a5de-f5fa70260c9b

Proposed filters for /staff/pets

  • Placement type
    • Adoptable
    • Fosterable
    • Adoptable & Fosterable
  • Adoption Status (rename from 'Status')
    • Adopted
    • Not adopted
  • Paused
    • Yes
    • No
  • Published
    • Yes
    • No

Foster Related Filters (not required - we already have filters doing this on on /staff/manage_fosters

Also - would be great to move Ransack logic on the Pet model into a concern - see how we do this for DefaultPetTask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Ready Make a comment to get assigned.
Projects
None yet
Development

No branches or pull requests

4 participants