Skip to content

Commit

Permalink
fix(frozen period): skip temporary accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed May 27, 2024
1 parent 6edf580 commit 02a45a3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions app/Controllers/FrozenPeriodController.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,13 @@ protected static function calculateValidSummaryCalculations(
if ($must_be_strict) {
foreach ($accounts as $account) {
if (
$account->kind === EXPENSE_ACCOUNT_KIND
|| $account->kind === INCOME_ACCOUNT_KIND
(
$account->kind === EXPENSE_ACCOUNT_KIND
|| $account->kind === INCOME_ACCOUNT_KIND
)
// Some accounts are temporary and exist only for closing other accounts.
// Therefore, they would not have any summary calculations.
&& isset($keyed_calculations[$account->id])
) {
$raw_calculation = $keyed_calculations[$account->id];
if (
Expand Down Expand Up @@ -670,6 +675,12 @@ function ($raw_summary_calculation) {
$raw_summary_calculations
);

$raw_flow_calculations = array_filter(
$raw_flow_calculations,
function ($raw_flow_calculation) {
return $raw_flow_calculation->net_amount->getSign() !== 0;
}
);
$retained_accounts_on_flow_calculations = array_map(
function ($raw_flow_calculation) {
return $raw_flow_calculation->account_id;
Expand Down

0 comments on commit 02a45a3

Please sign in to comment.