refactor(activity): create paired deposit for funded buys#727
refactor(activity): create paired deposit for funded buys#727kwaich wants to merge 2 commits intoafadil:mainfrom
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65de6b42f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub fn includes_cash_deposit(&self) -> bool { | ||
| self.get_meta::<bool>(METADATA_INCLUDE_CASH_DEPOSIT) | ||
| .unwrap_or(false) |
There was a problem hiding this comment.
Treat string include_cash_deposit as enabled
The new includes_cash_deposit() helper only reads a JSON boolean (get_meta::<bool>), so records with metadata like "include_cash_deposit": "true" are evaluated as false. This is a real input shape the frontend now handles when loading BUY defaults, and it means prefunded buys from that data path will still debit cash and will not book the external contribution, causing incorrect cash balances and net contribution values until the activity is manually rewritten.
Useful? React with 👍 / 👎.
|
Not sure about this one. This is what external TransferIn does. If it's for UX convenience, I wouldn't impact the calculator and the backend; I would just make the frontend create two activities. |
|
Agree with Afadil on that. |
|
yeah that make sense and keeps it simple, thanks |
When a buy activity is marked as funded (includes_cash_deposit=true), automatically create a paired DEPOSIT transaction for the same account, amount, and date. This ensures the portfolio's cash balance reflects the inflow before the buy is executed, giving accurate performance tracking.
5d795b4 to
2e96f1b
Compare
Description
When a buy activity is marked as "includes cash deposit", automatically create a paired
DEPOSITtransaction for the same account, amount, and date. This ensures the portfolio cash balance
reflects the inflow before the buy executes, giving accurate performance and cash tracking.
Changes:
use-activity-mutations.tsto create/update/delete the paired deposit in sync with the buyincludes_cash_depositfieldChecklist
Contributor License Agreement.
By submitting this PR, I agree to the
CLA.