mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 09:22:33 +00:00
Add lots of debug.
This commit is contained in:
@@ -411,6 +411,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getPaidDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
|
public function getPaidDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
|
||||||
{
|
{
|
||||||
|
Log::debug('Now in getPaidDatesInRange()');
|
||||||
return $bill->transactionJournals()
|
return $bill->transactionJournals()
|
||||||
->before($end)->after($start)->get(
|
->before($end)->after($start)->get(
|
||||||
[
|
[
|
||||||
|
@@ -167,19 +167,28 @@ class BillTransformer extends AbstractTransformer
|
|||||||
'next_expected_match' => null,
|
'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'));
|
$set = $this->repository->getPaidDatesInRange($bill, $this->parameters->get('start'), $this->parameters->get('end'));
|
||||||
Log::debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count()));
|
Log::debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count()));
|
||||||
|
|
||||||
// calculate next expected match:
|
// 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'));
|
$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) {
|
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);
|
$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) {
|
if ($set->count() > 0) {
|
||||||
$nextMatch = clone $end;
|
$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 = [];
|
$result = [];
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
@@ -189,11 +198,13 @@ class BillTransformer extends AbstractTransformer
|
|||||||
'date' => $entry->date->format('Y-m-d'),
|
'date' => $entry->date->format('Y-m-d'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
$result = [
|
||||||
return [
|
|
||||||
'paid_dates' => $result,
|
'paid_dates' => $result,
|
||||||
'next_expected_match' => $nextMatch->format('Y-m-d'),
|
'next_expected_match' => $nextMatch->format('Y-m-d'),
|
||||||
];
|
];
|
||||||
|
Log::debug('Result', $result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user