Skip to content

Firefly III: a personal finances manager

Add lots of debug.

James Colef78729fc8a0b
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index 8290c8479c..9de5306318 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -411,6 +411,7 @@ class BillRepository implements BillRepositoryInterface
*/
public function getPaidDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
{
+ Log::debug('Now in getPaidDatesInRange()');
return $bill->transactionJournals()
->before($end)->after($start)->get(
[
diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.php
index 6885f58fb0..e6de17cd8f 100644
--- a/app/Transformers/BillTransformer.php
+++ b/app/Transformers/BillTransformer.php
@@ -167,19 +167,28 @@ class BillTransformer extends AbstractTransformer
'next_expected_match' => null,
];
}
-
+ Log::debug(sprintf('Parameters are start:%s end:%s', $this->parameters->get('start')->format('Y-m-d'), $this->parameters->get('end')->format('Y-m-d')));
$set = $this->repository->getPaidDatesInRange($bill, $this->parameters->get('start'), $this->parameters->get('end'));
Log::debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count()));
// calculate next expected match:
+ Log::debug(
+ sprintf('Grab last paid date from getPaidDatesInRange(), return %s if it comes up with nothing.', $this->parameters->get('start')->format('Y-m-d'))
+ );
$lastPaidDate = $this->lastPaidDate($set, $this->parameters->get('start'));
- $nextMatch = clone $bill->date;
+ Log::debug(sprintf('Result of lastPaidDate is %s', $lastPaidDate->format('Y-m-d')));
+ $nextMatch = clone $bill->date;
+ Log::debug(sprintf('Next match is %s (bill->date)', $nextMatch->format('Y-m-d')));
while ($nextMatch < $lastPaidDate) {
+ Log::debug(sprintf('next match %s < last paid date %s, so add one period.', $nextMatch->format('Y-m-d'), $lastPaidDate->format('Y-m-d')));
$nextMatch = app('navigation')->addPeriod($nextMatch, $bill->repeat_freq, $bill->skip);
+ Log::debug(sprintf('Next match is now %s.', $nextMatch->format('Y-m-d')));
}
- $end = app('navigation')->addPeriod($nextMatch, $bill->repeat_freq, $bill->skip);
+ $end = app('navigation')->addPeriod($nextMatch, $bill->repeat_freq, $bill->skip);
+ Log::debug(sprintf('$end is another period added: %s', $end->format('Y-m-d')));
if ($set->count() > 0) {
$nextMatch = clone $end;
+ Log::debug(sprintf('Next match (%s) is now a clone of end, because the set has > 0 entries. .', $nextMatch->format('Y-m-d')));
}
$result = [];
foreach ($set as $entry) {
@@ -189,11 +198,13 @@ class BillTransformer extends AbstractTransformer
'date' => $entry->date->format('Y-m-d'),
];
}
-
- return [
+ $result = [
'paid_dates' => $result,
'next_expected_match' => $nextMatch->format('Y-m-d'),
];
+ Log::debug('Result', $result);
+
+ return $result;
}
/**