Skip to content

Commit

Permalink
feat(frozen period): include deleted entities on enriched document
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Aug 10, 2024
1 parent ec7981b commit 8d466ff
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/Controllers/FrozenPeriodController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected static function enrichResponseDocument(array $initial_document): array
$initial_document[static::getIndividualName()]->finished_at
)
)
->withDeleted()
->findAll();

foreach ($exchange_modifiers as $modifier) {
Expand All @@ -102,6 +103,7 @@ function ($modifier) {
$exchange_modifiers
))
->orderBy("transacted_at", "DESC")
->withDeleted()
->findAll()
: [];

Expand All @@ -113,6 +115,7 @@ function ($modifier) {
if (count($linked_accounts) > 0) {
$accounts = model(AccountModel::class)
->whereIn("id", array_unique($linked_accounts))
->withDeleted()
->findAll();
}
$enriched_document["accounts"] = $accounts;
Expand Down Expand Up @@ -162,6 +165,7 @@ function ($currency_builder) use ($initial_document) {
if (count($linked_cash_flow_activities) > 0) {
$cash_flow_activities = model(CashFlowActivityModel::class)
->whereIn("id", array_unique($linked_cash_flow_activities))
->withDeleted()
->findAll();
}
$enriched_document["cash_flow_activities"] = $cash_flow_activities;
Expand Down Expand Up @@ -231,6 +235,7 @@ protected static function calculateValidSummaryCalculations(
$financial_entries = model(FinancialEntryModel::class)
->where("transacted_at >=", $main_document["started_at"])
->where("transacted_at <=", $main_document["finished_at"])
->withDeleted()
->findAll();

[
Expand Down Expand Up @@ -369,6 +374,7 @@ private static function makeRawCalculations(array $financial_entries): array {
if (count($linked_modifiers) > 0) {
$modifiers = model(ModifierModel::class)
->whereIn("id", array_unique($linked_modifiers))
->withDeleted()
->findAll();
}

Expand Down Expand Up @@ -412,6 +418,7 @@ function ($raw_calculations, $account_id) {
if (count($linked_cash_flow_activities) > 0) {
$cash_flow_activities = model(CashFlowActivityModel::class)
->whereIn("id", array_unique($linked_cash_flow_activities))
->withDeleted()
->findAll();
}
$keyed_cash_flow_activities = array_reduce(
Expand Down Expand Up @@ -547,6 +554,7 @@ function ($previous_time, $current_entry) {
if (count($linked_accounts) > 0) {
$accounts = model(AccountModel::class)
->whereIn("id", array_unique($linked_accounts))
->withDeleted()
->findAll();
}
$keyed_accounts = array_reduce(
Expand Down Expand Up @@ -728,6 +736,7 @@ function ($raw_flow_calculation) {
$last_entry_transacted_time
)
)
->withDeleted()
->findAll();

$linked_exchange_accounts = [];
Expand All @@ -741,6 +750,7 @@ function ($raw_flow_calculation) {
if (count($linked_exchange_accounts) > 0) {
$exchange_accounts = model(AccountModel::class)
->whereIn("id", array_unique($linked_exchange_accounts))
->withDeleted()
->findAll();
}

Expand All @@ -753,6 +763,7 @@ function ($modifier) {
$exchange_modifiers
))
->orderBy("transacted_at", "DESC")
->withDeleted()
->findAll()
: [];

Expand Down Expand Up @@ -1234,7 +1245,7 @@ private static function getRelatedCurrencies(
$currencies = $currency_modifier($currencies);
}

return $currencies->findAll();
return $currencies->withDeleted()->findAll();
}

return $currencies;
Expand Down

0 comments on commit 8d466ff

Please sign in to comment.