rubyforgood / rubyforgood/casa

Periodically cleanup case contact drafts

Open
#5,442 22 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

no-issue-activity Stakeholder-Feature
Dominant language
Ruby
Stars
381
Forks
542
Avg merge
3d 15h
Merged PRs (30d)
47

Description

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

  • 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:

  • volunteer1@example.com view site as a volunteer
  • supervisor1@example.com view site as a supervisor
  • casa_admin1@example.com view site as an admin
  • all_casa_admin1@example.com view site as an all casa admin
    • go to /all_casa_admins/sign_in

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing case contact drafts and the existing periodic cleanup approach referenced in issue #5328. Compare a rake task or scheduled job with the Heroku Scheduler alternative, then add tests covering empty draft_case_ids, the one-day threshold, and drafts older than a week; done means both cleanup rules run periodically.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.