Athenodoros / TopHat

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

Incorrect category aggregation when changing parent #10

Closed oersted closed 2 years ago

oersted commented 2 years ago

Hello, me again, having a great experience with TopHat so far.

I just attempted to move a few categories under a different parent. All transactions changed properly (even without requiring a refresh), but it looks like the aggregated count for the parent is not recomputed and stays at zero.

I've had other problems like this in the past (see my previous issue). Before it was easy to clear all the data and import all the statements again, but after using TopHat for a couple of months this is no longer practical.

Could you perhaps add a button in Settings that recomputes all Category aggregations from scratch based on raw transaction data?

I wouldn't be surprised if more of these subtle bugs come up in the future, you know what they say about the hardest problems in CS and cache-invalidation. Having this button would significantly mitigate data corruption caused by this class of bugs.

Athenodoros commented 2 years ago

That's super weird - I've moved categories around and not seen any issues, and some quick experiments in a demo instance don't shed any light. Out of interest, where are you seeing the aggregated count not changing? I'm wondering if that's a clue.

In any case, I've added a button - have a look under the new "Debug" section in the settings menu, should fix it right up.

oersted commented 2 years ago

I see the zero count everywhere it appears, in the Category page, the charts...

More specifically, I moved a top-level category with some children below a new category, I also moved the children below the new category directly, and also moved some other children from another parent into it. None of it triggered a refresh on the aggregation. Re-running rules also didn't have an effect, and neither did deleting all transactions and reloading the statements.

I appreciate the new button, it solved the issue as expected, it's a really handy fall-back, I expect I will need it again.

Athenodoros commented 2 years ago

I don't really know what it could be - if I try it on a test instance then everything you mentioned seems to be fine, and all the summaries update to the correct numbers as expected.

I'll close this out now because it's not clear to me what's broken, but I guess let me know if you see something similar break again (or can find a repro)?