mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
This commit is contained in:
parent
590c33c0af
commit
289ccc7d89
@ -159,6 +159,7 @@ class ShowController extends Controller
|
|||||||
$object = $manager->createData($resource)->toArray();
|
$object = $manager->createData($resource)->toArray();
|
||||||
$object['data']['currency'] = $bill->transactionCurrency;
|
$object['data']['currency'] = $bill->transactionCurrency;
|
||||||
|
|
||||||
|
|
||||||
/** @var GroupCollectorInterface $collector */
|
/** @var GroupCollectorInterface $collector */
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
$collector->setBill($bill)->setLimit($pageSize)->setPage($page)->withBudgetInformation()
|
$collector->setBill($bill)->setLimit($pageSize)->setPage($page)->withBudgetInformation()
|
||||||
|
@ -186,16 +186,12 @@ class BillTransformer extends AbstractTransformer
|
|||||||
* The next expected match (nextMatch) is, initially, the bill's date.
|
* The next expected match (nextMatch) is, initially, the bill's date.
|
||||||
*/
|
*/
|
||||||
$nextMatch = clone $bill->date;
|
$nextMatch = clone $bill->date;
|
||||||
//app('log')->debug(sprintf('Next match is %s (bill->date)', $nextMatch->format('Y-m-d')));
|
/*
|
||||||
while ($nextMatch < $lastPaidDate) {
|
* Diff in months (or other period) between bill start and last paid date or $start.
|
||||||
/*
|
*/
|
||||||
* As long as this date is smaller than the last time the bill was paid, keep jumping ahead.
|
$steps = app('navigation')->diffInPeriods($bill->repeat_freq, $start, $nextMatch);
|
||||||
* For example: 1 jan, 1 feb, etc.
|
$nextMatch = app('navigation')->addPeriod($nextMatch, $bill->repeat_freq, $steps);
|
||||||
*/
|
|
||||||
//app('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);
|
|
||||||
//app('log')->debug(sprintf('Next match is now %s.', $nextMatch->format('Y-m-d')));
|
|
||||||
}
|
|
||||||
if ($nextMatch->isSameDay($lastPaidDate)) {
|
if ($nextMatch->isSameDay($lastPaidDate)) {
|
||||||
/*
|
/*
|
||||||
* Add another period because it's the same day as the last paid date.
|
* Add another period because it's the same day as the last paid date.
|
||||||
@ -215,7 +211,7 @@ class BillTransformer extends AbstractTransformer
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
//app('log')->debug('Result', $result);
|
app('log')->debug(sprintf('Next match: %s', $nextMatch->toIso8601String()));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'paid_dates' => $result,
|
'paid_dates' => $result,
|
||||||
@ -270,12 +266,12 @@ class BillTransformer extends AbstractTransformer
|
|||||||
app('log')->debug(sprintf('Current start is %s', $currentStart->toIso8601String()));
|
app('log')->debug(sprintf('Current start is %s', $currentStart->toIso8601String()));
|
||||||
$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);
|
$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);
|
||||||
|
|
||||||
app('log')->debug(sprintf('Next expected match is %s', $nextExpectedMatch->toIso8601String()));
|
|
||||||
// If nextExpectedMatch is after end, we continue:
|
// If nextExpectedMatch is after end, we continue:
|
||||||
if ($nextExpectedMatch > $this->parameters->get('end')) {
|
if ($nextExpectedMatch > $this->parameters->get('end')) {
|
||||||
app('log')->debug('Next expected match is after END, so stop looking');
|
app('log')->debug('Next expected match is after END, so stop looking');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
app('log')->debug(sprintf('Next expected match is %s', $nextExpectedMatch->toIso8601String()));
|
||||||
// add to set
|
// add to set
|
||||||
$set->push(clone $nextExpectedMatch);
|
$set->push(clone $nextExpectedMatch);
|
||||||
$nextExpectedMatch->addDay();
|
$nextExpectedMatch->addDay();
|
||||||
@ -290,6 +286,7 @@ class BillTransformer extends AbstractTransformer
|
|||||||
return $date->format('Y-m-d');
|
return $date->format('Y-m-d');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
app('log')->debug(sprintf('Found %d pay dates', $set->count()), $simple->toArray());
|
||||||
|
|
||||||
return $simple->toArray();
|
return $simple->toArray();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user