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

Running balance alongside transactions #142

Open
fmorency opened this issue Sep 25, 2023 · 4 comments
Open

Running balance alongside transactions #142

fmorency opened this issue Sep 25, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@fmorency
Copy link
Contributor

fmorency commented Sep 25, 2023

As a user, I need the capability to display a running balance column alongside my transaction records. This feature would help me easily track the evolving balance of my account as I make transactions, allowing for a quick and accurate assessment of my financial standing.

Relates #143

@stanleyjones
Copy link
Contributor

I've spent the morning looking into this issue and coming up with a few ways we could do it. Currently, Alberto does something like this:

  1. Fetch the 11 latest account events
  2. Fetch each transaction from its event
  3. Show the first 10 transactions
  4. If there are more than 10 transactions, show a "next" button
  5. Repeat when the user clicks the button, each time fetching 1 more than necessary to show

We have a few options:

  • (A) Fetch all the account events and transactions from the beginning and calculate a running balance from 0
  • (B) Fetch all the account events but delay fetching the transaction until it needs to be shown
  • (C) Fetch the current balance at the beginning and reverse transactions to get a running balance toward 0
  • (D) Calculate running balance to the back-end (probably events) and only display them in the front-end

Am I missing any ideas?

cc @fmorency @jgryffindor

@stanleyjones
Copy link
Contributor

  • (E) Fetch events and transactions async (not dependent on user interaction) and cache them somewhere more persistent than browser memory, e.g IndexedDB

@fmorency
Copy link
Contributor Author

fmorency commented Oct 12, 2023

@stanleyjones Check out #146, it contains things that will be useful for this task, i.e., useAllTransactionsList. You should be able to implement (A) or (B) with it.

We can look into (D) and (E) if/when we need to scale.

The only edge-case is the treasury which needs to start from the genesis balance and not 0.

@fmorency
Copy link
Contributor Author

@stanleyjones You're also welcome to comment/improve on that PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants