Unify From/To columns into Account + Counterparty + signed Amount#129
Draft
kramerc wants to merge 1 commit into
Draft
Unify From/To columns into Account + Counterparty + signed Amount#129kramerc wants to merge 1 commit into
kramerc wants to merge 1 commit into
Conversation
Replaces the From/To selects on the transactions table and inline form with an anchor account, a counterparty, and a single signed Amount field. On account-scoped views (/accounts/:id/transactions) the anchor is implicit (= the viewed account), so the form drops a field. On the unfiltered view an explicit Account column appears alongside Counterparty. Direction is inferred from the amount's sign: negative = outflow (anchor as src), zero/positive/blank = inflow (anchor as dest). The sign is stripped before reaching the model — amount_minor stays positive — so double-entry semantics are unchanged. Adds Transaction#anchor_account / counterparty_account / signed_amount_minor_for(account), helper methods for form pre-fill, and a translate_form_params step in TransactionsController. JSON API still accepts src_account_id / dest_account_id directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/accounts/:id/transactions) the anchor is implicit; the form drops a field. On the unfiltered view, an explicit Account column appears alongside Counterparty.-5.00= outflow (anchor as src),5.00= inflow (anchor as dest). The sign is stripped before reaching the model —amount_minorstays positive.Status
Draft / shelved. Open question: "Counterparty" is finance jargon and feels off for category-like accounts (Groceries, Salary). No replacement landed on yet — leaving as-is for now.
Test plan
bin/rails test— model tests foranchor_account/counterparty_account/signed_amount_minor_foracross all five transaction kinds plus an asset↔asset transfer; controller tests for negative/positive amount translation on POST and PATCH; JSON API still works withsrc/destdirectly.bin/rails test:system— header layout (scoped vs unfiltered), signed-amount class on both perspectives, inline create on both views with negative + positive amounts.bin/rubocopclean.bin/brakemanclean.🤖 Generated with Claude Code