casa
casa copied to clipboard
Periodically cleanup case contact drafts
What type(s) of user does this feature affect?
- volunteer
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:
-
draft_case_ids
is empty - case contact was created more than 1 days ago
We also want to delete old drafts in general.
- Any draft older than a week should get deleted.
Make sure to write tests!!!
As part of this work
- You may need to introduce a tool to run rake tasks or jobs periodically. One such tool is the whenever gem (but you could use a different one).
- If introduces a tool (like above) then incorporate with #5328 to make sure this runs on the 15th of every month
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:
- [email protected] view site as a volunteer
- [email protected] view site as a supervisor
- [email protected] view site as an admin
- [email protected] view site as an all casa admin
- go to
/all_casa_admins/sign_in
- go to
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.
I can work on this.
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.
@phonghpham The blocking issue and PR has been merged. So this is ready if you want it.
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
There was an after party task that ran on deployment that set their status as active.
@andreLumor lib/tasks/deployment/20231125151610_set_case_contacts_as_active.rake
Perfect then! I can start working on the issue if you wish.
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
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.
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?
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.
@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 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.
I would like to work on this
I would like to work on this
It is yours, @Smullz622!
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
Still working. The pr is out but on hold until stakeholders confirm all drafts should be cleared after one week
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
Still on hold until stakeholders confirm all drafts should be cleared after one week
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
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.