Skip to content

Add balance total after each transactions #570

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Arkarr
Copy link

@Arkarr Arkarr commented Apr 22, 2025

Hi,

This pull request is primarily made to answer to the following issue : #568

It should display account balance after each transactions.

The changes are summarized below :
I created three variables : _runningBalancesByTransactionId, _lastCalculatedBalance and _balanceAccount which store the balance for each transaction, store the last calculated balance and store a reference to the account respectively.
I created three helper functions _parseBalance, _isRevenueOrExpense, _updateBalance - maybe they should be moved else where.
Lines 267-288: This is where I update for each transactions the balance based on the last balance (either _lastCalculatedBalance or the actual account's balance)
Lines 725-739: When a transaction is edited for some reasons, the account linked to the transaction is being fetched and the balance is being re-calculated. This part of the code should probably be optimized.

I updated the syntax of some part of the code too.

Unit tests might be a good thing to add some days in the future. Maybe.

Disclaimer:
I never ever developed for mobiles, used Dart language nor used the "Flutter" framework.

@Arkarr Arkarr force-pushed the feature/add_balance_to_transactions branch from f5eba4b to b219468 Compare April 22, 2025 16:10
@dreautall
Copy link
Owner

Hi, thank you for this! I'll have a detailed look at this probably over the weekend.

After a first quick look, this only works on account transaction pages, not the overall (main) transaction page, correct? Have you looked at implementing it for the main transaction page as well?

I never ever developed for mobiles, used Dart language nor used the "Flutter" framework

Just for me, what's your coding experience so far? At a first glance the code looks pretty good 😄

@dreautall dreautall self-requested a review April 22, 2025 16:22
@dreautall dreautall added enhancement New feature or request dart Pull requests that update Dart code labels Apr 22, 2025
@dreautall dreautall linked an issue Apr 22, 2025 that may be closed by this pull request
@dreautall dreautall moved this to In Progress in Waterfly III Apr 22, 2025
@Arkarr
Copy link
Author

Arkarr commented Apr 22, 2025

Yeah, no worries. I am not in a hurry :) Although, it could definitely facilitate my life. I look forward that feature a lot.

After a first quick look, this only works on account transaction pages, not the overall (main) transaction page, correct? Have you looked at implementing it for the main transaction page as well?

I didn't want to - It might be confusing to view balances not aligning with the transactions above and/or under it. But if you think that's necessary, the logic should remain more or less the same.

Just for me, what's your coding experience so far? At a first glance the code looks pretty good 😄

I do it for a living.

@dreautall
Copy link
Owner

Just added a couple of code-style comments - didn't have time to spin up the emulator for now, sorry. I'm especially interested in the VisualDensity change and how the amount is displayed, but I'll check that then later.

I do it for a living.

More than me then 😉 So it's really only dart you're unfamiliar with I guess!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dart Pull requests that update Dart code enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Feature request: Add balance total for each transactions
2 participants