Skip to content

Commit

Permalink
Merge branch 'actualbudget:master' into tbuist-category-ui-bars
Browse files Browse the repository at this point in the history
  • Loading branch information
tbuist authored Feb 28, 2025
2 parents 488c682 + d11fc59 commit 76d3dc8
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .github/actions/bump-package-versions
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/bash
set -euo pipefail

version="${1#v}"
if [ "$#" -gt 0 ]; then
version="${1#v}"
else
version=""
fi

files_to_bump=(
packages/api/package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function Budget() {
);
} else {
dispatch(collapseModals('category-group-menu'));
dispatch(deleteGroup(groupId));
dispatch(deleteGroup({ id: groupId }));
}
},
[categoryGroups, dispatch],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,7 @@ function TransactionTableInner({
: trans.error;

const hasSplitError =
(trans.is_parent || trans.is_child) &&
(!expanded || isLastChild(transactions, index)) &&
error &&
error.type === 'SplitTransactionError';
Expand Down
14 changes: 10 additions & 4 deletions packages/loot-core/src/server/accounts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,13 +628,13 @@ type SyncResponse = {
updatedAccounts: Array<AccountEntity['id']>;
};

function handleSyncResponse(
async function handleSyncResponse(
res: {
added: Array<TransactionEntity['id']>;
updated: Array<TransactionEntity['id']>;
},
acct: db.DbAccount,
): SyncResponse {
): Promise<SyncResponse> {
const { added, updated } = res;
const newTransactions: Array<TransactionEntity['id']> = [];
const matchedTransactions: Array<TransactionEntity['id']> = [];
Expand All @@ -647,6 +647,9 @@ function handleSyncResponse(
updatedAccounts.push(acct.id);
}

const ts = new Date().getTime().toString();
await db.update('accounts', { id: acct.id, last_sync: ts });

return {
newTransactions,
matchedTransactions,
Expand Down Expand Up @@ -745,7 +748,7 @@ async function accountsBankSync({
acct.bankId,
);

const syncResponseData = handleSyncResponse(syncResponse, acct);
const syncResponseData = await handleSyncResponse(syncResponse, acct);

newTransactions.push(...syncResponseData.newTransactions);
matchedTransactions.push(...syncResponseData.matchedTransactions);
Expand Down Expand Up @@ -848,7 +851,10 @@ async function simpleFinBatchSync({
),
);
} else {
const syncResponseData = handleSyncResponse(syncResponse.res, account);
const syncResponseData = await handleSyncResponse(
syncResponse.res,
account,
);

newTransactions.push(...syncResponseData.newTransactions);
matchedTransactions.push(...syncResponseData.matchedTransactions);
Expand Down
7 changes: 6 additions & 1 deletion packages/loot-core/src/server/budget/cleanup-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ async function processCleanup(month: string): Promise<Notification> {
}

const budgetAvailable = await getSheetValue(sheetName, `to-budget`);
if (budgetAvailable <= 0) {
if (budgetAvailable < 0) {
warnings.push('Global: No funds are available to reallocate.');
}

Expand Down Expand Up @@ -351,6 +351,11 @@ async function processCleanup(month: string): Promise<Notification> {
message: 'Global: Funds not available:',
pre: warnings.join('\n\n'),
};
} else if (budgetAvailable === 0) {
return {
type: 'message',
message: 'All categories were up to date.',
};
} else {
return {
type: 'message',
Expand Down
19 changes: 19 additions & 0 deletions packages/loot-core/src/shared/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,23 @@ describe('Transactions', () => {
expect.objectContaining({ amount: 3002 }),
]);
});

test('deleting all child split transactions works', () => {
const transactions = [
makeTransaction({ amount: 2001 }),
...makeSplitTransaction(
{ id: 't1', amount: 2500, error: splitError(500) },
[{ id: 't2', amount: 2000 }],
),
makeTransaction({ amount: 3002 }),
];
const { data } = deleteTransaction(transactions, 't2');

expect(data).toEqual([
expect.objectContaining({ amount: 2001 }),
// Must delete error if no children
expect.objectContaining({ amount: 2500, error: null }),
expect.objectContaining({ amount: 3002 }),
]);
});
});
3 changes: 2 additions & 1 deletion packages/loot-core/src/shared/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,11 @@ export function deleteTransaction(
if (trans.id === id) {
return null;
} else if (trans.subtransactions?.length === 1) {
const { error, subtransactions, ...rest } = trans;
const { subtransactions, ...rest } = trans;
return {
...rest,
is_parent: false,
error: null,
} satisfies TransactionEntity;
} else {
const sub = trans.subtransactions?.filter(t => t.id !== id);
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/4465.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [jfdoming]
---

Fix crash when deleting child transactions from an errored split
6 changes: 6 additions & 0 deletions upcoming-release-notes/4468.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [youngcw]
---

Remove warning on cleanup templates if budget is already "clean"
6 changes: 6 additions & 0 deletions upcoming-release-notes/4469.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [matt-fidd]
---

Fix category group deletion on mobile
6 changes: 6 additions & 0 deletions upcoming-release-notes/4472.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [matt-fidd]
---

Add last bank sync tracking back in

0 comments on commit 76d3dc8

Please sign in to comment.