Skip to content

Commit

Permalink
fix(frozen period): create summary calculations properly
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Aug 26, 2023
1 parent bba3aa5 commit 18f55cf
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions app/Controllers/FrozenPeriodController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ function ($raw_summary_calculation) use ($main_document) {
},
$raw_summary_calculations
);
$summary_calculations = model(SummaryCalculationModel::class)
->insertBatch($raw_summary_calculations)
->findAll();
$processed_document["summary_calculations"] = $summary_calculations;

model(SummaryCalculationModel::class)->insertBatch($raw_summary_calculations);

return $created_document;
}
Expand Down Expand Up @@ -156,19 +154,6 @@ private static function makeRawSummaryCalculations(array $financial_entries): ar
->findAll();
}

$linked_currencies = [];
foreach ($accounts as $document) {
$currency_id = $document->currency_id;
array_push($linked_currencies, $currency_id);
}

$currencies = [];
if (count($linked_currencies) > 0) {
$currencies = model(CurrencyModel::class)
->whereIn("id", array_unique($linked_currencies))
->findAll();
}

$grouped_financial_entries = array_reduce(
$financial_entries,
function ($groups, $entry) {
Expand Down

0 comments on commit 18f55cf

Please sign in to comment.