Athenodoros / TopHat

An in-browser personal finance app
GNU General Public License v3.0
125 stars 9 forks source link

Category aggregations not working properly #8

Closed oersted closed 2 years ago

oersted commented 2 years ago

Per category aggregations are not properly refreshed when running rules or importing statements. This is a rather critical issue, it makes a big part of the app unusable.

Inspecting the data model in IndexedDB shows that there's a two-way reference between statements and categories. Statements have a category attribute with the category ID, and categories have a transtactions attribute that contains a copy of the relevant amounts. These two are not always consistent.

This can be easily reproduced:

  1. Start with a clean TopHat instance
  2. Import a Statement
  3. Create a Category
  4. Create a Rule to bind the Category to some statements and run it
  5. The Category aggregation is still zero in the charts
  6. Clicking on the Category does correctly show the relevant transactions, but their values are not aggregated

The only way I've found to synchronize the aggregations is to manually set the transactions with the category as "No Category". Strangely, this transaction is added to the category aggregation right after removing the category from it, which is also incorrect.

oersted commented 2 years ago

Also, I've noticed that categorized sums have the opposite sign (positive-negative) in the Income, Expenses and All Transactions charts.

And a quality of life suggestion: disallow not having a Reference pattern in Rules. It's quite easy to accidentally leave the pattern blank (since it also requires pressing the Enter key to actually input the pattern, which is not obvious). Then the Rule applies the Category to all transactions, which can be a pain to clean up, and can wipe all manually applied categories.

oersted commented 2 years ago

I'd like to say though, I'm really liking the app. It's so much more useable and modern than most alternatives like GNUCash, KMyMoney, or Moneydance.

Sure, there are plenty of excellent personal finance apps like Intuit's Mint. But they require directly linking with banks, which is often not possible if your accounts are international. I'd like to manually import CSVs. And they lack the privacy aspect of having all the data be local.

I'm giving this feedback because I badly want TopHat to be my main accounting solution, but it needs to work first :)

Athenodoros commented 2 years ago

Oof, that's a bad one - thanks for the bug report. I've pushed out a fix for this (the logic for applying individual rules didn't update those transaction summaries you saw in IndexedDB - I've linked the PR above if you're interested). TopHat will refresh all of those caches next time you open it, so it should be good to go.

On the other ones you had:

Athenodoros commented 2 years ago

Okay, for the reference pattern I've changed it so that whenever you click away, it saves what you'd typed as a search filter - I think that makes more sense than just removing it.

Hope that helps, and glad you're enjoying it! Let me know if you see anything else weird.

oersted commented 2 years ago

Excellent! Thanks for the rapid action. I'll give it another try as soon as I get the time and will let you know.

oersted commented 2 years ago

I've spent a few hours setting up everything again. Great experience, no other issues, and excellent UX. It's ready to be my main accounting solution now :)