mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-04 21:15:19 +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:
parent
c003e8c6ed
commit
63d8114b05
28 changed files with 147 additions and 115 deletions
|
@ -298,35 +298,4 @@ class Transaction::SearchTest < ActiveSupport::TestCase
|
|||
assert_equal Money.new(0, "USD"), totals.expense_money
|
||||
assert_equal Money.new(0, "USD"), totals.income_money
|
||||
end
|
||||
|
||||
test "totals respects excluded transactions filter from search" do
|
||||
# Create an excluded transaction (should be excluded by default)
|
||||
excluded_entry = create_transaction(
|
||||
account: @checking_account,
|
||||
amount: 100,
|
||||
kind: "standard"
|
||||
)
|
||||
excluded_entry.update!(excluded: true) # Marks it as excluded
|
||||
|
||||
# Create a normal transaction
|
||||
normal_entry = create_transaction(
|
||||
account: @checking_account,
|
||||
amount: 50,
|
||||
kind: "standard"
|
||||
)
|
||||
|
||||
# Default behavior should exclude excluded transactions
|
||||
search = Transaction::Search.new(@family)
|
||||
totals = search.totals
|
||||
|
||||
assert_equal 1, totals.count
|
||||
assert_equal Money.new(50, "USD"), totals.expense_money # Only non-excluded transaction
|
||||
|
||||
# Explicitly include excluded transactions
|
||||
search_with_excluded = Transaction::Search.new(@family, filters: { excluded_transactions: true })
|
||||
totals_with_excluded = search_with_excluded.totals
|
||||
|
||||
assert_equal 2, totals_with_excluded.count
|
||||
assert_equal Money.new(150, "USD"), totals_with_excluded.expense_money # Both transactions
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue