Fix some things in recurring transactions.

This commit is contained in:
James Cole
2020-05-04 10:26:01 +02:00
parent 6f6087995d
commit be8286b15c
5 changed files with 56 additions and 15 deletions

View File

@@ -111,12 +111,18 @@ class IndexController extends Controller
$array['first_date'] = new Carbon($array['first_date']);
$array['repeat_until'] = null === $array['repeat_until'] ? null : new Carbon($array['repeat_until']);
$array['latest_date'] = null === $array['latest_date'] ? null : new Carbon($array['latest_date']);
$array['occurrences'] = [];
if (0 !== $recurrence->recurrenceRepetitions->count()) {
$array['ocurrences'] = array_slice($this->recurring->getOccurrencesInRange($recurrence->recurrenceRepetitions->first(), $today, $year), 0, 1);
// make carbon objects out of occurrences
foreach ($array['repetitions'] as $repIndex => $repetition) {
foreach ($repetition['occurrences'] as $occIndex => $occurrence) {
$array['repetitions'][$repIndex]['occurrences'][$occIndex] = new Carbon($occurrence);
}
}
//if (0 !== $recurrence->recurrenceRepetitions->count()) {
//$array['ocurrences'] = array_slice($this->recurring->getOccurrencesInRange($recurrence->recurrenceRepetitions->first(), $today, $year), 0, 1);
//}
$recurring[] = $array;
}
$paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page);