Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Make sure the loop is broken. #595
James Coleeed8fe22c6a8
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.phpindex 9a82bcade7..96bf953590 100644--- a/app/Http/Controllers/AccountController.php+++ b/app/Http/Controllers/AccountController.php@@ -258,8 +258,12 @@ class AccountController extends Controllerif (strlen($moment) > 0 && $moment !== 'all') {$start = new Carbon($moment);$end = Navigation::endOfPeriod($start, $range);- $subTitle = $account->name . ' (' . strval(trans('firefly.from_to_breadcrumb',- ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)])) . ')';+ $subTitle = $account->name . ' (' . strval(+ trans(+ 'firefly.from_to_breadcrumb',+ ['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]+ )+ ) . ')';$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d')]);$periods = $this->periodEntries($account);}@@ -273,10 +277,13 @@ class AccountController extends Controller$accountType = $account->accountType->type;$count = 0;+ $loop = 0;// grab journals, but be prepared to jump a period back to get the right ones:- while ($count === 0) {+ Log::info('Now at loop start.');+ while ($count === 0 && $loop < 3) {+ $loop++;$collector = app(JournalCollectorInterface::class);- Log::debug('Count is zero, search for journals.');+ Log::info('Count is zero, search for journals.');$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);if (!is_null($start)) {$collector->setRange($start, $end);@@ -288,7 +295,7 @@ class AccountController extends Controller$start->subDay();$start = Navigation::startOfPeriod($start, $range);$end = Navigation::endOfPeriod($start, $range);- Log::debug(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));+ Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));}}diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.phpindex 45a7b70733..908effbe73 100644--- a/tests/Feature/Controllers/AccountControllerTest.php+++ b/tests/Feature/Controllers/AccountControllerTest.php@@ -175,7 +175,7 @@ class AccountControllerTest extends TestCase{$this->be($this->user());$this->changeDateRange($this->user(), $range);- $response = $this->get(route('accounts.show.all', [1]));+ $response = $this->get(route('accounts.show', [1, 'all']));$response->assertStatus(200);// has bread crumb$response->assertSee('<ol class="breadcrumb">');