mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 16:13:54 +00:00
Fix filtered list.
This commit is contained in:
@@ -40,6 +40,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
|||||||
|
|
||||||
public function enrich(Collection $collection): Collection
|
public function enrich(Collection $collection): Collection
|
||||||
{
|
{
|
||||||
|
Log::debug(sprintf('%s(%s item(s))', __METHOD__, $collection->count()));
|
||||||
$this->calculator = app(BillDateCalculator::class);
|
$this->calculator = app(BillDateCalculator::class);
|
||||||
$this->collection = $collection;
|
$this->collection = $collection;
|
||||||
$this->collectSubscriptionIds();
|
$this->collectSubscriptionIds();
|
||||||
@@ -205,7 +206,6 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
|||||||
$searchStart->startOfDay();
|
$searchStart->startOfDay();
|
||||||
$searchEnd->endOfDay();
|
$searchEnd->endOfDay();
|
||||||
|
|
||||||
Log::debug(sprintf('Parameters are start: %s, end: %s', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
|
|
||||||
Log::debug(sprintf('Search parameters are: start: %s, end: %s', $searchStart->format('Y-m-d H:i:s'), $searchEnd->format('Y-m-d H:i:s')));
|
Log::debug(sprintf('Search parameters are: start: %s, end: %s', $searchStart->format('Y-m-d H:i:s'), $searchEnd->format('Y-m-d H:i:s')));
|
||||||
|
|
||||||
// Get from database when bills were paid.
|
// Get from database when bills were paid.
|
||||||
@@ -244,7 +244,10 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
|||||||
|
|
||||||
// At this point the "next match" is exactly after the last time the bill was paid.
|
// At this point the "next match" is exactly after the last time the bill was paid.
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($set as $entry) {
|
$filtered = $set->filter(function (TransactionJournal $journal) use ($subscription) {
|
||||||
|
return (int) $journal->bill_id === (int) $subscription->id;
|
||||||
|
});
|
||||||
|
foreach ($filtered as $entry) {
|
||||||
$array = [
|
$array = [
|
||||||
'transaction_group_id' => (string)$entry->transaction_group_id,
|
'transaction_group_id' => (string)$entry->transaction_group_id,
|
||||||
'transaction_journal_id' => (string)$entry->id,
|
'transaction_journal_id' => (string)$entry->id,
|
||||||
@@ -288,6 +291,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
|||||||
$filtered = $dates->filter(function (TransactionJournal $journal) use ($subscription) {
|
$filtered = $dates->filter(function (TransactionJournal $journal) use ($subscription) {
|
||||||
return (int) $journal->bill_id === (int) $subscription->id;
|
return (int) $journal->bill_id === (int) $subscription->id;
|
||||||
});
|
});
|
||||||
|
Log::debug(sprintf('Filtered down from %d to %d entries for bill #%d.', $dates->count(), $filtered->count(), $subscription->id));
|
||||||
if (0 === $filtered->count()) {
|
if (0 === $filtered->count()) {
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user