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

Auto-cleanup payees/categories that have no transactions #107

Open
scottohara opened this issue Nov 11, 2015 · 2 comments
Open

Auto-cleanup payees/categories that have no transactions #107

scottohara opened this issue Nov 11, 2015 · 2 comments

Comments

@scottohara
Copy link
Owner

A common scenario is to enter a transaction from a receipt with a merchant like "XYZ Holdings Pty Ltd"; only to later discover the commonly known trading name for that business (eg. "Bob's Pizza's").

When the transaction was created, we automatically create "XYZ Holdings Pty Ltd" as a payee (assuming we've never seen them before); and later when we edit the transaction's payee to "Bob's Pizza's", it creates another new payee.

The original payee ("XYZ Holdings") now has no transactions associated with it; so we no longer need to keep it in the database.

Effectively, we want to "ref count" payees/categories/securities; and when the ref count drops to zero (ie. not referenced by any transactions), delete it.

We could potentially do this on transaction save (note that if the transaction type changes, we delete & reinsert; so we would need to snapshot the original details before deleting, so that we can determine what to cleanup afterwards).

Or, like we do with scheduled transactions; we could run a process as part of the login that detects any orphaned entries and cleans them up (the downside there is that we slowdown login).

Or, we use this as an opportunity (perhaps as part of the Rails 5 upgrade...ie. ActiveJob) to look at introducing background processing

@scottohara
Copy link
Owner Author

Or, like we do with scheduled transactions; we could run a process as part of the login that detects any orphaned entries and cleans them up (the downside there is that we slowdown login).

Or we do it when the Payees/Categories List is displayed, with a toast or banner showing at the top of the page, e.g.

"There are 3 payees that have no no associated transactions. Would you like to remove them? Yes | No"

@scottohara
Copy link
Owner Author

For now, we have Heroku data clips that show us any orphaned payees/categories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant