Skip to content

A local-first personal finance app

Support nynab imports that have (#2817)

Stefan Hall6d117f44de92
diff --git a/packages/desktop-client/e2e/data/ynab5-demo-budget.json b/packages/desktop-client/e2e/data/ynab5-demo-budget.json
index fd9993975e..3539fb56b4 100644
--- a/packages/desktop-client/e2e/data/ynab5-demo-budget.json
+++ b/packages/desktop-client/e2e/data/ynab5-demo-budget.json
@@ -102,10 +102,22 @@
"name": "Store",
"transfer_account_id": null,
"deleted": false
+ },
+ {
+ "id": "620e85b1-2ae7-45b1-bb3e-b875ea5c553a",
+ "name": "Work",
+ "transfer_account_id": null,
+ "deleted": false
}
],
"payee_locations": [],
"category_groups": [
+ {
+ "id": "a5c355c2-3b77-4a7f-b8b3-c832b10cfec8",
+ "name": "Income",
+ "hidden": false,
+ "deleted": false
+ },
{
"id": "d5c355c2-3b77-4a7f-b8b3-c832b10cfec9",
"name": "Internal Master Category",
@@ -611,6 +623,30 @@
"goal_overall_funded": null,
"goal_overall_left": null,
"deleted": false
+ },
+ {
+ "id": "1429f287-50aa-49d8-a89c-752cbd167d6c",
+ "category_group_id": "a5c355c2-3b77-4a7f-b8b3-c832b10cfec8",
+ "name": "Income",
+ "hidden": false,
+ "original_category_group_id": null,
+ "note": null,
+ "budgeted": 0,
+ "activity": 0,
+ "balance": 0,
+ "goal_type": "NEED",
+ "goal_day": null,
+ "goal_cadence": 1,
+ "goal_cadence_frequency": 1,
+ "goal_creation_month": null,
+ "goal_target": 0,
+ "goal_target_month": null,
+ "goal_percentage_complete": null,
+ "goal_months_to_budget": null,
+ "goal_under_funded": null,
+ "goal_overall_funded": null,
+ "goal_overall_left": null,
+ "deleted": false
}
],
"months": [
@@ -1711,6 +1747,26 @@
"import_payee_name_original": null,
"debt_transaction_type": null,
"deleted": false
+ },
+ {
+ "id": "9a22f287-f1e0-4667-9fc0-91e4a4262193",
+ "date": "2024-02-02",
+ "amount": 2000000,
+ "memo": "Paycheck",
+ "cleared": "cleared",
+ "approved": true,
+ "flag_color": null,
+ "account_id": "bc1d862f-bab0-41c3-bd1e-6cee8c688e32",
+ "payee_id": "620e85b1-2ae7-45b1-bb3e-b875ea5c553a",
+ "category_id": "1429f287-50aa-49d8-a89c-752cbd167d6c",
+ "transfer_account_id": null,
+ "transfer_transaction_id": null,
+ "matched_transaction_id": null,
+ "import_id": null,
+ "import_payee_name": null,
+ "import_payee_name_original": null,
+ "debt_transaction_type": null,
+ "deleted": false
}
],
"subtransactions": [
diff --git a/packages/desktop-client/e2e/onboarding.test.js b/packages/desktop-client/e2e/onboarding.test.js
index 78d5aa0a8f..926d24bcd9 100644
--- a/packages/desktop-client/e2e/onboarding.test.js
+++ b/packages/desktop-client/e2e/onboarding.test.js
@@ -59,7 +59,7 @@ test.describe('Onboarding', () => {
await expect(budgetPage.budgetTable).toBeVisible({ timeout: 30000 });
const accountPage = await navigation.goToAccountPage('Checking');
- await expect(accountPage.accountBalance).toHaveText('600.00');
+ await expect(accountPage.accountBalance).toHaveText('2,600.00');
await navigation.goToAccountPage('Saving');
await expect(accountPage.accountBalance).toHaveText('250.00');
diff --git a/packages/loot-core/src/server/importers/ynab5.ts b/packages/loot-core/src/server/importers/ynab5.ts
index 4ef00137ae..2595d5957b 100644
--- a/packages/loot-core/src/server/importers/ynab5.ts
+++ b/packages/loot-core/src/server/importers/ynab5.ts
@@ -63,6 +63,10 @@ async function importCategories(
findIdByName(data.category_groups, 'Credit Card Payments')
) {
return 'creditCard';
+ } else if (
+ cat.category_group_id === findIdByName(data.category_groups, 'Income')
+ ) {
+ return 'income';
}
}
// Can't be done in parallel to have
@@ -74,7 +78,8 @@ async function importCategories(
// Ignores internal category and credit cards
if (
!equalsIgnoreCase(group.name, 'Internal Master Category') &&
- !equalsIgnoreCase(group.name, 'Credit Card Payments')
+ !equalsIgnoreCase(group.name, 'Credit Card Payments') &&
+ !equalsIgnoreCase(group.name, 'Income')
) {
groupId = await actual.createCategoryGroup({
name: group.name,
@@ -83,6 +88,11 @@ async function importCategories(
entityIdMap.set(group.id, groupId);
}
+ if (equalsIgnoreCase(group.name, 'Income')) {
+ groupId = incomeCatId;
+ entityIdMap.set(group.id, groupId);
+ }
+
const cats = data.categories.filter(
cat => cat.category_group_id === group.id,
);
diff --git a/upcoming-release-notes/2817.md b/upcoming-release-notes/2817.md
new file mode 100644
index 0000000000..ac3db69568
--- /dev/null
+++ b/upcoming-release-notes/2817.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [Marethyu1]
+---
+
+Fixes nynab import issue where you couldn't import a category group called 'Income'