jameskokoska / Cashew

💸 An app created to help users manage a budget and purchases
https://cashewapp.web.app/
GNU General Public License v3.0
1.75k stars 239 forks source link

[Bug] Amount of Transactions Mismatch in all spendings page #380

Closed Radwan-Albahrani closed 2 months ago

Radwan-Albahrani commented 2 months ago

Describe the bug In the all spendings page, the net total shows a total amount of transactions that is different from the total if you add up the transaction amounts in the card below it.

How to reproduce

Screenshots/videos IMG_8383

The Balance correction here is due to the fact i transferred money from Account A to account B, but marked the "transfer out" transaction as a payment to an LTL, as shown below. image

And it seems stuff like this is not added to the card. as when i click in the balance correction line, i dont see that transaction anymore.

Also. Lent Shows that there are 4 transactions, but when clicking on it, i see more than 4 image image

Details

Additional notes This appears to be an error in the outside filter compared to the inside filter. In the case of loans, the outside filter says 4 at the total count, but the inside filter shows more. Unsure what the filters are and if they are accurate considering the numbers outside and inside are different and I cannot isolate which transactions it is talking about

jameskokoska commented 2 months ago

Can you please provide a minimum reproducible example so I can further look into this issue? I am not able to replicate the issue.

You can also provide a copy of your data, however be mindful of sharing sensitive financial information.

Radwan-Albahrani commented 2 months ago

It seems I was able to produce a minimal viable example using the following steps:

Leaving me with the following result. 4 total transactions. but 1 balance correction, and 1 lent. And when clicking on lent, you will see 2 transactions

All Spending Page: image

Lent Transactions: image

Net Total Transaction: image

jameskokoska commented 2 months ago

The main issue here is that "Paid" transactions are not counted in the "All Spending Total Row" but when listed in the transaction search page, the count is all the transactions listed. Unfortunately, I think this discrepancy is always going to be the case. Once one time loans have been marked as paid, we don't want to count the transactions in the total count as they are already settled. This is to be consistent with the homepage loans widget as well.

There is some weird behaviour here, however, with Balance Corrections also being part of a short term loan not properly filtering out when on the Search page that I can look into. (i.e. the filter "No Loan" doesn't seem to be applied to also removing one time loans)

There is also another bug that selecting a history time period removed the totals for Loans, which was accidentally left from the previous version's logic. This created an incorrect net from adding all the totals in the rows, which is not the intended behaviour.

I will look into these related issues

jameskokoska commented 2 months ago

Fixed here: https://github.com/jameskokoska/Cashew/commit/9795ac4f1b8d8d6b2e91bdf172359d13336f5344