Skip to content
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

[Bug]: Filtered balance on Split's notes not calculating properly #4381

Open
1 task done
Rescue9 opened this issue Feb 14, 2025 · 1 comment
Open
1 task done

[Bug]: Filtered balance on Split's notes not calculating properly #4381

Rescue9 opened this issue Feb 14, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Rescue9
Copy link

Rescue9 commented Feb 14, 2025

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

When trying to filter transactions by Note, the "Filtered Balance" doesn't include the split if each line doesn't also have the note.

I would expect that the split be included if each split note is empty. If each split has a different note, then those splits should be filtered accordingly. For example, in the image, if the note on the External Purchases split said "Family" I would not expect it to calculate in the "contains kro" filter. However, those splits that are empty should calculate. Otherwise, every split needs to have all fields filed out to calculate properly.

Image

How can we reproduce the issue?

How can we reproduce the issue?
Create a split transaction, notate the main split, but not the individual sub-splits, filter by note. Filtered Balance will be different than expected, and not show non-notated sub-splits.

Where are you hosting Actual?

Locally via Yarn

What browsers are you seeing the problem on?

Chrome, Firefox

Operating System

Windows 11

@Rescue9 Rescue9 added the bug Something isn't working label Feb 14, 2025
@Rescue9 Rescue9 changed the title [Bug]: Filtered balance on Split's ntoes not calculating properly [Bug]: Filtered balance on Split's notes not calculating properly Feb 14, 2025
@alecbakholdin
Copy link
Contributor

alecbakholdin commented Feb 26, 2025

I looked into this and I'm able to reproduce it as well, not just in the account filter but also in reports if you make a custom report and add a filter that matches both child and parent, you will only see the parent transaction. The issue seems to be happening here

s.where = `${s.where} AND ${s.from}.is_parent = 0`;

if (isAggregateQuery(queryState)) {
    const s = { ...sql };

    // Modify the where to only include non-parents
    s.where = `${s.where} AND ${s.from}.is_parent = 0`;

    // We also want to exclude deleted transactions. Normally we
    // handle this manually down below, but now that we are doing a
    // normal query we want to rely on the view. Unfortunately, SQL
    // has already been generated so we can't easily change the view
    // name here; instead, we change it and map it back to the name
    // used elsewhere in the query. Ideally we'd improve this
    if (!withDead) {
      s.from = 'v_transactions_internal_alive v_transactions_internal';
}

(Note the ${s.from}.is_parent = 0) For aggregate queries we simply don't consider split parent transactions at all. I don't immediately see a good solution to this and I'm new to the codebase so probably shouldn't be modifying something as integral as this right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants