-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculated income excludes off-budget to on-budget transactions #1007
Comments
Thanks for this detailed report. BugYou are indeed correct, this is a bug. Transactions from off-budget to on-budget accounts without an Envelope need to be considered for Transaction filteringThe transaction filtering again has a different understanding, which I have come to consider wrong, too. I thought about this for a while and arrived at the conclusion that we'll need two different filters, one direction filter and one type filter. direction: purely for internal/external account considerations Has the following filter values
type: For the effect a transaction has on the budget Has the following filter values
I'm not yet happy with incoming and income being named this similarly. Any suggestions to improve this are very welcome. |
@ekeih I think you meant that it should be
instead, right? You had the I moved the changes to transaction filtering to #1024 to handle them separately. |
Oh, yes you are right, I mixed that up 😬 Thanks for the fix! 🚀 |
Describe the bug
/v4/months
returns an attribute.income
which is documented in the source asThe total income for the month (sum of all incoming transactions without an Envelope)
..available
if it is not transferred to an envelope.backend/pkg/models/budget.go
Line 61 in ca55deb
At first glance I thought it could be resolved by changing this line toWhere("source_account.external = 1 OR source_account.on_budget = 0").
. But after thinking about it a bit more I think the query needs to be more specific. Because there are also cases liketransferring off-budget to off-budget
to consider and maybe more.INCOMING
direction filter for transactions inbackend/pkg/controllers/v4/transaction.go
Lines 240 to 246 in ca55deb
Where("source_account.external = 1").
inbudget.go
should beWhere("accounts_source.on_budget = true AND accounts_destination.on_budget = false").
instead.INCOMING
direction filter should exclude transactions that are allocated to an envelope right away?)To Reproduce
.income
attribute of/api/v4/months
of the budget..income
again. It is the same as in step 2, but I believe it should have increased by the transferred amount.Expected behavior
Off-budget to on-budget transactions without an envelope are included in the
.income
calculation ofv4/months
.Additional context
.income
as far as I can see..income
in the frontend. I could work around this by quering transactions (filtered fordirection=INCOMING
andenvelope=
) and adding their amounts. But after thinking about this for an hour and looking at the backend source I think this is a bug in the backend.The text was updated successfully, but these errors were encountered: