Skip to content

hledger-flow reports empty for user sub-accounts (due to missing directives.journal at lower levels) #112

@stewmehr

Description

@stewmehr

Describe the bug
I have set up an account structure with several users in my ./import directory (e.g. ./import/userA/bankX/checking/1-in, ./import/userB/bankY/checking/1-in, etc. ...). This works fine in terms of importing CSVs and generating journal files, but I am struggling with hledger-flow report. The generated ./reports directory looks as follows:

reports
├── all
│   └── 2023
│       ├── balance-sheet.txt
│       ├── income-expenses.txt
│       ├── monthly
│           └── income-expenses.txt
├── userA
│   └── 2023
│       ├── accounts.txt
│       ├── balance-sheet.txt
│       ├── income-expenses.txt
│       └── monthly
│           └── income-expenses.txt
└── userB
    └── 2023
        ├── accounts.txt
        ├── balance-sheet.txt
        ├── income-expenses.txt
        └── monthly
            └── income-expenses.txt

Unfortunately, only the reports in ./reports/all contain any numbers whereas the reports generated for userA and userB are empty. This is due to the fact that all my account info, including non-default account names and types, is stored in ./directives.journal in the top-level directory. By default, this directives file is only included in ./all-years.journal but not included in ./import/user{A,B}/all-years.journal. Thus, hledger does not know the correct mapping of my income and expense accounts and is unable to generate any income statements or balance sheets for individual user accounts.

This can easily be fixed by appending the line

include ../../directives.journal

to the respective all-years.journal files at lower levels. I am not sure if this is the most efficient solution but I cannot think of a better one right now.

Version and Runtime Information

Please mention the version number of hledger-flow you are using:

hledger-flow 0.15.0 darwin x86_64 ghc 9.2 4c5ba1281b33852c1fba1f2f01eb5d2d9921ded9

Is this the latest version? Yes
Please confirm your issue using the latest version of hledger-flow, maybe it has already been fixed. No

Also include the runtime options of the command you ran, e.g:

$ hledger-flow report

To Reproduce

Issue cannot be reproduced with data available at
https://github.com/apauley/hledger-flow-example
as the repo's import directory contains only a single user directory.

Expected behavior

I would expect the reports in directories other than all not to be empty.

Desktop (please complete the following information):

  • OS: macOS Monterey
  • Version 12.6.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions