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

Periodically cleanup case contact drafts #5442

Open
schoork opened this issue Dec 17, 2023 · 21 comments · May be fixed by #5918
Open

Periodically cleanup case contact drafts #5442

schoork opened this issue Dec 17, 2023 · 21 comments · May be fixed by #5918
Labels
Stakeholder-Feature A feature requested by the stakeholders

Comments

@schoork
Copy link
Collaborator

schoork commented Dec 17, 2023

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:

  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.

  • Any draft older than a week should get deleted.

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.

@schoork schoork added the Help Wanted This is a special label that enables github to showcase issues that want help label Dec 17, 2023
@phonghpham
Copy link

I can work on this.

@schoork
Copy link
Collaborator Author

schoork commented Dec 18, 2023

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 schoork added not-ready-to-build and removed Help Wanted This is a special label that enables github to showcase issues that want help labels Dec 18, 2023
@schoork
Copy link
Collaborator Author

schoork commented Jan 15, 2024

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

@schoork schoork added Help Wanted This is a special label that enables github to showcase issues that want help and removed not-ready-to-build labels Jan 15, 2024
@andreLumor
Copy link
Collaborator

andreLumor commented Jan 30, 2024

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
Copy link
Collaborator Author

schoork commented Jan 30, 2024

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

@schoork
Copy link
Collaborator Author

schoork commented Jan 31, 2024

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

@andreLumor
Copy link
Collaborator

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

@github-actions github-actions bot removed the Help Wanted This is a special label that enables github to showcase issues that want help label Jan 31, 2024
Copy link

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

Copy link

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
Copy link
Collaborator

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
Copy link
Collaborator Author

schoork commented May 20, 2024

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
Copy link
Collaborator

elasticspoon commented May 26, 2024

@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
Copy link
Collaborator Author

schoork commented May 27, 2024

@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.

@elasticspoon elasticspoon added Help Wanted This is a special label that enables github to showcase issues that want help Stakeholder-Feature A feature requested by the stakeholders and removed not-ready-to-build labels Jun 20, 2024
@elasticspoon elasticspoon changed the title Periodically cleanup drafts with no case id Periodically cleanup case contact drafts Jul 7, 2024
@Smullz622
Copy link
Collaborator

I would like to work on this

@github-actions github-actions bot removed the Help Wanted This is a special label that enables github to showcase issues that want help label Jul 13, 2024
@schoork
Copy link
Collaborator Author

schoork commented Jul 13, 2024

I would like to work on this

It is yours, @Smullz622!

@Smullz622 Smullz622 linked a pull request Jul 16, 2024 that will close this issue
Copy link

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
Copy link
Collaborator

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

Copy link

github-actions bot commented Aug 4, 2024

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
Copy link
Collaborator

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

Copy link

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

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stakeholder-Feature A feature requested by the stakeholders
Projects
Status: Needs Stakeholder Info
Development

Successfully merging a pull request may close this issue.

5 participants