Skip to content

Commit

Permalink
tree table: restore v1.25 layout
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgerstmayr authored and yagebu committed Sep 9, 2023
1 parent 216d7dd commit c3d7198
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
13 changes: 9 additions & 4 deletions frontend/src/reports/tree_reports/IncomeStatement.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@
{/if}

<div class="row">
{#each trees as tree}
<div class="column">
<div class="column">
{#each trees.slice(0, 2) as tree}
<TreeTable {tree} end={date_range?.end ?? null} />
</div>
{/each}
{/each}
</div>
<div class="column">
{#each trees.slice(2) as tree}
<TreeTable {tree} end={date_range?.end ?? null} />
{/each}
</div>
</div>
5 changes: 4 additions & 1 deletion frontend/src/stores/accounts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { derived } from "svelte/store";

import { _ } from "../i18n";

import { account_details, fava_options, options } from ".";

/** Whether an account should be collapsed in the account trees. */
Expand All @@ -16,7 +18,8 @@ export const invert_account = derived(
? (name) =>
name.startsWith($options.name_income) ||
name.startsWith($options.name_liabilities) ||
name.startsWith($options.name_equity)
name.startsWith($options.name_equity) ||
name === _("Net Profit")
: () => false,
);

Expand Down
2 changes: 1 addition & 1 deletion src/fava/json_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,8 @@ def get_income_statement() -> TreeReport:
root_tree = g.filtered.root_tree
trees = [
root_tree.get(options["name_income"]),
root_tree.get(options["name_expenses"]),
root_tree.net_profit(options, gettext("Net Profit")),
root_tree.get(options["name_expenses"]),
]

return TreeReport(
Expand Down
26 changes: 13 additions & 13 deletions tests/__snapshots__/test_json_api.py-test_api-income_statement
Original file line number Diff line number Diff line change
Expand Up @@ -2670,6 +2670,19 @@
],
"has_txns": false
},
{
"account": "Net Profit",
"balance": {
"USD": -35857.24,
"VACHR": -130
},
"balance_children": {
"USD": -35857.24,
"VACHR": -130
},
"children": [],
"has_txns": true
},
{
"account": "Expenses",
"balance": {},
Expand Down Expand Up @@ -3046,19 +3059,6 @@
}
],
"has_txns": false
},
{
"account": "Net Profit",
"balance": {
"USD": -35857.24,
"VACHR": -130
},
"balance_children": {
"USD": -35857.24,
"VACHR": -130
},
"children": [],
"has_txns": true
}
]
}

0 comments on commit c3d7198

Please sign in to comment.