Skip to content
Snippets Groups Projects
user avatar
James Long authored
Route aggregate queries in transaction grouped mode through the correct layer to remove deleted transactions (#247)

I recently migrated my personal usage of Actual over to the open-source
version and imported a bunch of transactions. I have a _lot_ of history
in Actual, including a lot of weird edge cases like deleted split
transactions. While reconciling I noticed that my account balance shown
at the top was incorrect, even though the running balance was current.

Digging into this, I discovered that we aren't correctly handling
aggregate queries when querying transactions in the "grouped" mode.
Aggregate queries don't make sense in the "grouped" mode. Grouped means
that you want a list of transactions that include both the parent and
child transactions (when they are split). If you are summing up all the
amount, you only want to consider non-parent transactions. So we switch
it back to "inline" mode, but the way we did this previously was to
manually stitch the query together.

Even though was add SQL to ignore deleted transactions, we still
possibly include them. A child transaction may not be marked as deleted,
even though the parent transaction is deleted. When a parent transaction
is deleted, all child transactions should be considered deleted as well,
regardless of their tombstone status. This is what the
`v_transactions_internal_alive` view does. Previously we weren't going
through this view though, so we could still potentially include split
transactions even though they've been deleted.

This is little hacky, but it fixes the immediate problem. We fall back
to the inline mode by modifying the where clause, and we also adjust the
view that it queries to use the correct one.
df8f5853
History

Actualbudget

Getting Started

Actual is a local-first personal finance tool. It is 100% free and open-source, written in NodeJS, it has a synchronization element so that all your changes can move between devices without any heavy lifting.

If you are interested in contributing, or want to know how development works, see CONTRIBUTING.md we would love to have you.

Want to say thanks? Click the ⭐ at the top of the page.

Key Links

Installation

If you are only interested in running the latest version and not contributing to the source code, you don't need to clone this repo. You can get the latest version through npm.

The easy way: using a server (recommended)

The easiest way to get Actual running is to use the actual-server project. That is the server for syncing changes across devices, and it comes with the latest version of Actual. The server will provide both the web project and a server for syncing.

You can get up and running quickly and easily by following our Running Actual Locally Guide

Documentation

We have a wide range of documentation on how to use Actual, this is all available in our Community Documentation, this includes topics on Budgeting, Account Management, Tips & Tricks and some documentation for developers.

Code structure

The Actual app is split up into a few packages:

  • loot-core - The core application that runs on any platform
  • loot-design - The generic design components that make up the UI
  • desktop-client - The desktop UI
  • desktop-electron - The desktop app

More information on the project structure is available in our community documentation.

Sponsors

Thanks to our wonderful sponsors who make Actual budget possible!

Deploys by Netlify