Skip to content

Commit

Permalink
feat(frozen period): make exchange rates to be available
Browse files Browse the repository at this point in the history
Closes #5
  • Loading branch information
KennethTrecy committed Sep 19, 2023
1 parent aca2cdf commit 097d289
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/Controllers/FrozenPeriodController.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ protected static function calculateValidSummaryCalculations(

[
$accounts,
$raw_summary_calculations
$raw_summary_calculations,
$raw_exchange_rates
] = static::makeRawSummaryCalculations($financial_entries);
$keyed_calculations = static::keySummaryCalculationsWithAccounts($raw_summary_calculations);

Expand All @@ -140,7 +141,8 @@ protected static function calculateValidSummaryCalculations(

return [
$accounts,
$raw_summary_calculations
$raw_summary_calculations,
$raw_exchange_rates
];
}

Expand All @@ -158,7 +160,8 @@ function($request_data) use ($controller) {
$info = static::prepareRequestData($request_data);
[
$accounts,
$raw_summary_calculations
$raw_summary_calculations,
$raw_exchange_rates
] = static::calculateValidSummaryCalculations(
$info,
false
Expand All @@ -172,7 +175,8 @@ function($request_data) use ($controller) {

$response_document = [
"@meta" => [
"statements" => $statements
"statements" => $statements,
"exchange_rates" => $raw_exchange_rates
],
static::getIndividualName() => $info,
"summary_calculations" => $raw_summary_calculations,
Expand Down Expand Up @@ -520,15 +524,15 @@ function ($raw_exchanges, $modifier) use ($raw_exchange_entries) {
"currency_id" => $destination_currency_id,
"value" => $destination_value
],
"updated_at" => $financial_entry->updated_at
"updated_at" => $financial_entry->updated_at->toDateTimeString()
];
}

return $raw_exchanges;
},
[]
);
$raw_exchange_rates = array_value($raw_exchange_rates);
$raw_exchange_rates = array_values($raw_exchange_rates);

$accounts = array_filter(
$accounts,
Expand Down

0 comments on commit 097d289

Please sign in to comment.