diff --git a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php index 7c6a8a8a5b..fbc11552be 100644 --- a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php +++ b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php @@ -57,10 +57,12 @@ class PiggyBankEnrichment implements EnrichmentInterface private readonly TransactionCurrency $primaryCurrency; private User $user; private UserGroup $userGroup; + private ?Carbon $date; public function __construct() { $this->primaryCurrency = Amount::getPrimaryCurrency(); + $this->date = now(config('app.timezone')); } public function enrich(Collection $collection): Collection @@ -69,7 +71,6 @@ class PiggyBankEnrichment implements EnrichmentInterface $this->collectIds(); $this->collectObjectGroups(); $this->collectNotes(); - $this->collectCurrentAmounts(); $this->appendCollectedData(); @@ -157,8 +158,8 @@ class PiggyBankEnrichment implements EnrichmentInterface } // get suggested per month. - $meta['save_per_month'] = Steam::bcround($this->getSuggestedMonthlyAmount($item->start_date, $item->target_date, $meta['target_amount'], $meta['current_amount']), $currency->decimal_places); - $meta['pc_save_per_month'] = Steam::bcround($this->getSuggestedMonthlyAmount($item->start_date, $item->target_date, $meta['pc_target_amount'], $meta['pc_current_amount']), $currency->decimal_places); + $meta['save_per_month'] = Steam::bcround($this->getSuggestedMonthlyAmount($this->date, $item->target_date, $meta['target_amount'], $meta['current_amount']), $currency->decimal_places); + $meta['pc_save_per_month'] = Steam::bcround($this->getSuggestedMonthlyAmount($this->date, $item->target_date, $meta['pc_target_amount'], $meta['pc_current_amount']), $currency->decimal_places); $item->meta = $meta; @@ -166,7 +167,13 @@ class PiggyBankEnrichment implements EnrichmentInterface }); } - private function collectCurrentAmounts(): void {} + public function setDate(?Carbon $date): void + { + $this->date = $date; + } + + + private function collectIds(): void { diff --git a/changelog.md b/changelog.md index 1c9594c475..b0421f2815 100644 --- a/changelog.md +++ b/changelog.md @@ -24,9 +24,11 @@ This project adheres to [Semantic Versioning](http://semver.org/). - [Issue 10954](https://github.com/firefly-iii/firefly-iii/issues/10954) (Internal Server Error when trying to access (default) account) reported by @thomaschristory - [Issue 10956](https://github.com/firefly-iii/firefly-iii/issues/10956) (Manual webhook trigger fail) reported by @dudu7731 - [Issue 10960](https://github.com/firefly-iii/firefly-iii/issues/10960) (404 after deleting subscription) reported by @lindely +- #10965 - [Discussion 10974](https://github.com/orgs/firefly-iii/discussions/10974) (Big webhook_messages table) started by @Billos - #10988 - [Issue 10990](https://github.com/firefly-iii/firefly-iii/issues/10990) (duplicate piggy event via API) reported by @4e868df3 +- #10994 ### API