mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 05:09:38 +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
|
@ -0,0 +1,33 @@
|
|||
class UpdateExcludedTransactionsToOneTime < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
# Update all transactions that have excluded entries to be one_time
|
||||
# They remain excluded as well since users were using excluded as "one time" before
|
||||
execute <<~SQL
|
||||
UPDATE transactions
|
||||
SET kind = 'one_time'
|
||||
FROM entries
|
||||
WHERE entries.entryable_id = transactions.id
|
||||
AND entries.entryable_type = 'Transaction'
|
||||
AND entries.excluded = true
|
||||
AND transactions.kind = 'standard'
|
||||
SQL
|
||||
end
|
||||
|
||||
dir.down do
|
||||
# Revert one_time transactions back to standard if their entry is excluded
|
||||
# This assumes these were the ones we migrated in the up method
|
||||
execute <<~SQL
|
||||
UPDATE transactions
|
||||
SET kind = 'standard'
|
||||
FROM entries
|
||||
WHERE entries.entryable_id = transactions.id
|
||||
AND entries.entryable_type = 'Transaction'
|
||||
AND entries.excluded = true
|
||||
AND transactions.kind = 'one_time'
|
||||
SQL
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
2
db/schema.rb
generated
2
db/schema.rb
generated
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2025_06_18_120703) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2025_06_20_204550) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue