Closed UnderKoen closed 3 weeks ago
Name | Link |
---|---|
Latest commit | 5e5020ea8e9b09d5ff0e390dcbc5e3f6c71deaee |
Latest deploy log | https://app.netlify.com/sites/actualbudget/deploys/6717e64c364c6c00082d234e |
Deploy Preview | https://deploy-preview-3704.demo.actualbudget.org |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.
As this PR is updated, I'll keep you updated on how the bundle size is impacted.
Total
Files count | Total bundle size | % Changed |
---|---|---|
9 | 5.32 MB | 0% |
Changeset
No files were changed
Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.
As this PR is updated, I'll keep you updated on how the bundle size is impacted.
Total
Files count | Total bundle size | % Changed |
---|---|---|
1 | 1.27 MB → 1.27 MB (+63 B) | +0.00% |
This pull request introduces modifications to two files within the packages/loot-core/src/server/accounts
directory: rules.ts
and transaction-rules.ts
. In rules.ts
, the exec
method of the Action
class is updated to include a new conditional block that sets the payee
property of an object to the string 'new'
when the field
is 'payee_name'
. This change affects how actions related to the payee_name
field are executed. In transaction-rules.ts
, the finalizeTransactionForRules
function is modified to alter the logic for setting the payee
property of a transaction. The new logic checks if trans.payee
equals 'new'
and, if so, evaluates the trans.payee_name
to either retrieve an existing payee ID or insert a new payee. If trans.payee_name
is not defined, trans.payee
is set to null
. Minor formatting adjustments, such as the addition of a newline, are also included but do not impact functionality.
rules.ts
file, enhancing type safety and structure in the same file as the main PR.payee_name
in rules.ts
, relevant to the new logic in the exec
method.execActions
function in rules.ts
, closely related to the changes in the exec
method of the Action
class.rules.ts
, relevant to the changes regarding payee_name
handling in the main PR.sparkles: Merged
packages/loot-core/src/server/accounts/transaction-rules.ts (2)
``` Learnt from: UnderKoen PR: actualbudget/actual#3619 File: packages/loot-core/src/server/accounts/transaction-rules.ts:795-801 Timestamp: 2024-10-09T20:30:39.127Z Learning: In the `finalizeTransactionForRules` function within `packages/loot-core/src/server/accounts/transaction-rules.ts`, potential race conditions when inserting payees are handled in the method that calls this function, so additional safeguards within `finalizeTransactionForRules` are unnecessary. ``` ``` Learnt from: UnderKoen PR: actualbudget/actual#3619 File: packages/loot-core/src/server/accounts/transaction-rules.ts:551-0 Timestamp: 2024-10-09T20:17:46.493Z Learning: When finalizing transactions that involve inserting or retrieving payees, avoid using `Promise.all` as it may result in duplicate payees due to concurrent operations. Sequential processing ensures payees are correctly handled without duplication. ```
packages/loot-core/src/server/accounts/transaction-rules.ts (1)
`795-805`: **LGTM! New payee handling logic looks good.** The changes introduce a clear and concise way to handle new payees: 1. It checks if `trans.payee` is set to 'new'. 2. If `trans.payee_name` is provided, it either retrieves an existing payee or inserts a new one. 3. If `trans.payee_name` is not provided, it sets `trans.payee` to null. This approach ensures that new payees are correctly processed and set in the transaction.packages/loot-core/src/server/accounts/rules.ts (1)
`628-631`: **Consider updating related code for consistency** The addition of this code block is a good step towards handling the `payee_name` field correctly. However, there are a few points to consider: 1. This change sets the `payee` field to 'new' when `payee_name` is set, which aligns with the changes made in the `finalizeTransactionForRules` function (as mentioned in the AI summary for another file). 2. It's worth noting that this change might have implications for other parts of the codebase that deal with payee-related logic. Ensure that this new behavior is consistent with the overall payee handling strategy. 3. The string 'new' is used as a magic value. Consider defining this as a constant at the module level for better maintainability. To ensure consistency across the codebase, let's check for other occurrences of payee-related logic:✅ Verification successful
**Verified payee-related logic consistency** Only two instances found where `payee` is set to `'new'`. No additional inconsistencies detected. Consider defining `'NEW_PAYEE_VALUE'` as a constant for better maintainability.🏁 Scripts executed
The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Search for payee-related logic in the codebase rg -i "payee.*=.*['\"](new|null)" --type ts ``` Length of output: 223
hook test
test again
test again