Support nynab imports that have (#2817)

- category groups called income
- categories called income
This commit is contained in:
Stefan Hall
2024-06-05 05:33:28 +12:00
committed by GitHub
parent 64821e6a64
commit 6d117f44de
4 changed files with 74 additions and 2 deletions

View File

@@ -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": [

View File

@@ -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');

View File

@@ -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,
);

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [Marethyu1]
---
Fixes nynab import issue where you couldn't import a category group called 'Income'