rubyforgood / casa

Volunteer management system for nonprofit CASA, which serves foster youth in counties across America.
https://casavolunteertracking.org/
MIT License
306 stars 473 forks source link

Periodically cleanup case contact drafts #5442

Open schoork opened 9 months ago

schoork commented 9 months ago

What type(s) of user does this feature affect?

Description

5414 introduced the potential for case contact drafts to not be attached to a Casa Case (or cases). In this situation, if a user leaves step 1 without selecting at least one casa case, they will not be able to return to that draft.

We need to introduce a way to clean these up periodically (delete them). They should be any case contacts that meet the following criteria:

  1. draft_case_ids is empty
  2. case contact was created more than 1 days ago

We also want to delete old drafts in general.

Make sure to write tests!!!

As part of this work

Alternatively similar to #5328 this could be done as a rake task that will then be run using the heroku scheduler

Screenshots of current behavior, if any

You can paste images on the clipboard here

How to access the QA site

Login Details:
Link to QA site

Login Emails:

password for all users: 12345678

Questions? Join Slack!

We highly recommend that you join us in slack #casa channel to ask questions quickly. And discord for office hours (currently Tuesday 5-7pm Pacific), stakeholder news, and upcoming new issues.

phonghpham commented 9 months ago

I can work on this.

schoork commented 9 months ago

Thanks @phonghpham. It's not quite ready to be worked, since it needs the PR it mentions to be merged first. When it's ready, will circle back to see if you still want to do it.

schoork commented 8 months ago

@phonghpham The blocking issue and PR has been merged. So this is ready if you want it.

andreLumor commented 8 months ago

Hello! One question about this issue. From what I could see in the controller, what defines a draft is status being different from "active". Wouldn't this change also delete old case contacts? since they have "started" status by default and empty draft_case_ids

schoork commented 8 months ago

There was an after party task that ran on deployment that set their status as active.

schoork commented 8 months ago

@andreLumor lib/tasks/deployment/20231125151610_set_case_contacts_as_active.rake

andreLumor commented 8 months ago

Perfect then! I can start working on the issue if you wish.

github-actions[bot] commented 8 months ago

This issue has been inactive for 250 hours (10.42 days) and will be unassigned after 110 more hours (4.58 days). If you have questions, please

If you are still working on this, comment here to tell the bot to give you more time

github-actions[bot] commented 7 months ago

This issue has been inactive for 370 hours (15.42 days) and is past the limit of 360 hours (15.00 days) so is being unassigned.You’ve just been unassigned from this ticket due to inactivity – but feel free to pick it back up (or a new one!) in the future! Thank you again for your contribution to this project.

andreLumor commented 6 months ago

Hey @schoork, had some time issues, but now I can finish this task. One thing I was wondering is the usage of the whenever gem, since it (and other cron gems) doesn't work with heroku apps. (https://github.com/javan/whenever?tab=readme-ov-file#heroku). Wouldn't it be better to keep using heroku scheduler, as in the linked birthday reminder task?

schoork commented 4 months ago

Hey @schoork, had some time issues, but now I can finish this task. One thing I was wondering is the usage of the whenever gem, since it (and other cron gems) doesn't work with heroku apps. (https://github.com/javan/whenever?tab=readme-ov-file#heroku). Wouldn't it be better to keep using heroku scheduler, as in the linked birthday reminder task?

Yeah, didn't know that about Heroku and cron, but Heroku scheduler sounds good.

elasticspoon commented 4 months ago

@schoork Where is the 1 day coming from?

Is there any situation where a draft without a case ID might hang around for longer than that and be otherwise accessible? Me and Linda talked a bit about this today and really want to avoid a situation were useful data is deleted.

schoork commented 4 months ago

@schoork Where is the 1 day coming from?

Is there any situation where a draft without a case ID might hang around for longer than that and be otherwise accessible? Me and Linda talked a bit about this today and really want to avoid a situation were useful data is deleted.

I think it was something Brandon and I may have discussed (or maybe I just made it up). I'm totally cool with extending it, or even having a database flag where a user could mark it for deletion. Also, if this is not an issue for users, then we should just close it as not doing.

Smullz622 commented 3 months ago

I would like to work on this

schoork commented 2 months ago

I would like to work on this

It is yours, @Smullz622!

github-actions[bot] commented 2 months ago

This issue has been inactive for 249 hours (10.38 days) and will be unassigned after 111 more hours (4.63 days). If you have questions, please

If you are still working on this, comment here to tell the bot to give you more time

Smullz622 commented 2 months ago

Still working. The pr is out but on hold until stakeholders confirm all drafts should be cleared after one week

github-actions[bot] commented 2 months ago

This issue has been inactive for 252 hours (10.50 days) and will be unassigned after 108 more hours (4.50 days). If you have questions, please

If you are still working on this, comment here to tell the bot to give you more time

Smullz622 commented 2 months ago

Still on hold until stakeholders confirm all drafts should be cleared after one week

github-actions[bot] commented 1 month ago

This issue has been inactive for 252 hours (10.50 days) and will be unassigned after 108 more hours (4.50 days). If you have questions, please

If you are still working on this, comment here to tell the bot to give you more time

github-actions[bot] commented 1 month ago

This issue has been inactive for 372 hours (15.50 days) and is past the limit of 360 hours (15.00 days) so is being unassigned.You’ve just been unassigned from this ticket due to inactivity – but feel free to pick it back up (or a new one!) in the future! Thank you again for your contribution to this project.