Skip to content

!dev: lib: Allow Account to store date-indexed balances. #2395

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

Merged
merged 1 commit into from
Jun 5, 2025

Conversation

Xitian9
Copy link
Collaborator

@Xitian9 Xitian9 commented Jun 3, 2025

This upgrades Account to enable it to store a multiperiod balance, with a separate balance for each date period. This enables it do the hard work in MultiBalanceReport.

Some new types are created to enable convenient operation of accounts.

  • BalanceData is a type which stores an exclusive balance, inclusive balance, and number of postings. This was previously directly stored in Account, but is now factored into a separate data type.
  • PeriodData is a container which stores date-indexed data, as well as pre-period data. In post cases, this represents the report spans, along with the historical data.
  • Account becomes polymorphic, allowing customisation of the type of data it stores. This will usually be BalanceData, but in BudgetReport it can use These BalanceData BalanceData to store both actuals and budgets in the same structure. The data structure changes to contain a PeriodData, allowing multiperiod accounts.

Some minor changes are made to behaviour for consistency:

  • --declared treats parent accounts consistently.
  • --flat --empty ensures that implied accounts with no postings are not displayed, but accounts with zero balance and actual postings are.

This is a squashed version of #2360.

@simonmichael simonmichael added the needs-rebase To unblock: needs to be rebased against latest master branch label Jun 4, 2025
@simonmichael
Copy link
Owner

Great, let's rebase this for merge, superseding #2360.

I tried to resolve the conflict through github ui with 0119843 but I don't like the result, could you force-push a clean rebase instead.

This upgrades Account to enable it to store a multiperiod balance, with
a separate balance for each date period. This enables it do the hard
work in MultiBalanceReport.

Some new types are created to enable convenient operation of accounts.
- `BalanceData` is a type which stores an exclusive balance, inclusive
  balance, and number of postings. This was previously directly stored
  in Account, but is now factored into a separate data type.
- `PeriodData` is a container which stores date-indexed data, as well as
  pre-period data. In post cases, this represents the report spans,
  along with the historical data.
- Account becomes polymorphic, allowing customisation of the type of
  data it stores. This will usually be `BalanceData`, but in
  `BudgetReport` it can use `These BalanceData BalanceData` to store
  both actuals and budgets in the same structure. The data structure
  changes to contain a `PeriodData`, allowing multiperiod accounts.

Some minor changes are made to behaviour for consistency:
- --declared treats parent accounts consistently.
- --flat --empty ensures that implied accounts with no postings are not displayed, but
  accounts with zero balance and actual postings are.
@Xitian9 Xitian9 force-pushed the multiaccount-rebased branch from 0119843 to c22f5ab Compare June 5, 2025 08:30
@Xitian9
Copy link
Collaborator Author

Xitian9 commented Jun 5, 2025

Rebased.

@simonmichael simonmichael merged commit 80cf1d1 into simonmichael:master Jun 5, 2025
1 check passed
@simonmichael
Copy link
Owner

Thank you very much ! Merged.

@simonmichael simonmichael removed the needs-rebase To unblock: needs to be rebased against latest master branch label Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants