Skip to content

feat(categories): support dual-use income and expense categories - #544

Open
marianialessandro wants to merge 2 commits into
RIP-Comm:mainfrom
marianialessandro:feature/510-dual-use-categories
Open

marianialessandro wants to merge 2 commits into
RIP-Comm:mainfrom
marianialessandro:feature/510-dual-use-categories

Conversation

@marianialessandro

Copy link
Copy Markdown
Contributor

This pull request addresses issue #510 by introducing categories that can be used for both income and expense transactions. Users can now create an "Income & Expense" category and select it in either transaction flow, so they no longer need to maintain two separate categories for the same purpose.

These dual-use categories are stored using the new BOTH value. They appear in the appropriate category selectors, are included in frequent-category results, and can also be selected when creating a budget. The category itself does not determine whether a transaction is treated as income or an expense. That still depends on the transaction type, so income and expense totals continue to be calculated correctly.

Budget calculations now consider only expense transactions. This means that income assigned to a dual-use category does not increase that category's budget spending or progress. When the type of a parent category is changed, the new type is also applied to all of its subcategories, along with the parent's color.

The change is backward-compatible and does not require a database migration, because the existing category type column already stores unrestricted text values rather than limiting them to IN or OUT. Existing categories therefore continue to work as before, and their identifiers, notes, and transaction associations remain unchanged.

Automated tests cover the full behavior introduced by this change. They verify that the new category type can be correctly serialized and used in the category form and budget flow. They also check that dual-use categories can be selected and appear among frequent categories for both income and expense transactions. Finally, the tests confirm compatibility with an existing populated SQLite database and ensure that income assigned to a dual-use category is excluded from budget spending calculations.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant