Skip to content

A local-first personal finance app

Fix Sankey income bug, when payee it not set (#7632)

Emil Tveden Bjerglund33af9bf906b8
diff --git a/packages/desktop-client/src/components/reports/spreadsheets/sankey-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/sankey-spreadsheet.ts
index 3207982a78..ab34ed1095 100644
--- a/packages/desktop-client/src/components/reports/spreadsheets/sankey-spreadsheet.ts
+++ b/packages/desktop-client/src/components/reports/spreadsheets/sankey-spreadsheet.ts
@@ -682,7 +682,7 @@ function createTransactionsGraph(categoryData: CategoryEntry[]): Graph {
categoryData.forEach(entry => {
if (entry.accountId && entry.accountName && entry.categoryId) {
- if (entry.isIncome && entry.payeeId) {
+ if (entry.isIncome) {
// Payee > Income category > Account
addNode(
graph,
@@ -691,9 +691,16 @@ function createTransactionsGraph(categoryData: CategoryEntry[]): Graph {
entry.category,
);
addNode(graph, entry.accountId, GraphLayers.Account, entry.accountName);
- addNode(graph, entry.payeeId, GraphLayers.IncomePayee, entry.payeeName);
addValueToLink(graph, entry.categoryId, entry.accountId, entry.value);
- addValueToLink(graph, entry.payeeId, entry.categoryId, entry.value);
+ if (entry.payeeId) {
+ addNode(
+ graph,
+ entry.payeeId,
+ GraphLayers.IncomePayee,
+ entry.payeeName,
+ );
+ addValueToLink(graph, entry.payeeId, entry.categoryId, entry.value);
+ }
} else {
// Account > Category group > Category
addNode(graph, entry.accountId, GraphLayers.Account, entry.accountName);
diff --git a/upcoming-release-notes/7632.md b/upcoming-release-notes/7632.md
new file mode 100644
index 0000000000..cb6bcf72fa
--- /dev/null
+++ b/upcoming-release-notes/7632.md
@@ -0,0 +1,6 @@
+---
+category: Bugfixes
+authors: [emiltb]
+---
+
+Fix Sankey income being shown as spent money, when payee was not set