1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Separate exclude and one-time transaction handling (#2400)

* Separate exclude and one-time transaction handling

- Split transaction "exclude" and "one-time" toggles into separate controls in transaction detail view
- Updated Transaction::Search to show excluded transactions with grayed-out styling instead of filtering them out
- Modified IncomeStatement calculations to exclude both excluded and one_time transactions from totals
- Added migration to convert existing excluded transactions to also be one_time for backward compatibility
- Updated transaction list view to show asterisk for one_time transactions and gray out excluded ones
- Added controller support for kind parameter in transaction updates

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix linting issues

- Remove trailing whitespace from migration
- Fix ERB formatting throughout templates

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Zach Gollwitzer 2025-06-20 17:10:36 -04:00 committed by GitHub
parent c003e8c6ed
commit 63d8114b05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 147 additions and 115 deletions

View file

@ -48,6 +48,7 @@ class IncomeStatement::CategoryStats
)
WHERE a.family_id = :family_id
AND t.kind NOT IN ('funds_movement', 'one_time', 'cc_payment')
AND ae.excluded = false
GROUP BY c.id, period, CASE WHEN ae.amount < 0 THEN 'income' ELSE 'expense' END
)
SELECT

View file

@ -44,7 +44,8 @@ class IncomeStatement::FamilyStats
er.to_currency = :target_currency
)
WHERE a.family_id = :family_id
AND t.kind NOT IN ('funds_movement', 'one_time', 'cc_payment')
AND t.kind NOT IN ('funds_movement', 'one_time', 'cc_payment')
AND ae.excluded = false
GROUP BY period, CASE WHEN ae.amount < 0 THEN 'income' ELSE 'expense' END
)
SELECT

View file

@ -45,6 +45,7 @@ class IncomeStatement::Totals
er.to_currency = :target_currency
)
WHERE at.kind NOT IN ('funds_movement', 'one_time', 'cc_payment')
AND ae.excluded = false
GROUP BY c.id, c.parent_id, CASE WHEN ae.amount < 0 THEN 'income' ELSE 'expense' END;
SQL
end

View file

@ -14,7 +14,6 @@ class Transaction::Search
attribute :merchants, array: true
attribute :tags, array: true
attribute :active_accounts_only, :boolean, default: true
attribute :excluded_transactions, :boolean, default: false
attr_reader :family
@ -29,7 +28,6 @@ class Transaction::Search
query = family.transactions
query = apply_active_accounts_filter(query, active_accounts_only)
query = apply_excluded_transactions_filter(query, excluded_transactions)
query = apply_category_filter(query, categories)
query = apply_type_filter(query, types)
query = apply_merchant_filter(query, merchants)
@ -89,13 +87,6 @@ class Transaction::Search
end
end
def apply_excluded_transactions_filter(query, excluded_transactions_filter)
unless excluded_transactions_filter
query.where(entries: { excluded: false })
else
query
end
end
def apply_category_filter(query, categories)
return query unless categories.present?