redstreet/beancount_reds_importers

Balance entries malformed

Closed this issue · 2 comments

The Fava API was having trouble jsonifying imports. Turns out it was because of a single count object that made its way into metadata for balance entries. I looked at the data it was attempting to run through json.dumps and saw this:

    transaction = {
        "meta": {
            "filename": "ChaseXXXX....QFX",
            "lineno": count(250),
        },
        "date": datetime.date(2023, 5, 5),
        "account": "Liabilities:Current-Liabilities:Credit-Cards:Chase:Sapphire-Reserve",
        "amount": {"number": "-5442.48", "currency": "USD"},
        "tolerance": None,
        "diff_amount": None,
        "type": "Balance",
    }

I suspect it's because next() isn't being used on this metadata initialization

Suspected fix is to do next(counter).

edit: tested this fix on my machine--works!

Great, thanks for finding these bugs, and for trying out the fix :). I don't use imports via Fava, so this is helpful.

Thanks for the fix! I was just about to create a report for this, but it was already taken care of :)

For the search-bots, this is the error message produced by Fava:

TypeError: Object of type count is not JSON serializable