Fix some errors found in debug logs.

This commit is contained in:
James Cole 2018-07-27 03:09:35 +02:00
parent d6298d9f05
commit 2ad8e7f343
5 changed files with 10 additions and 10 deletions

View File

@ -359,7 +359,7 @@ class MetaPieChart implements MetaPieChartInterface
$repository->setUser($this->user);
foreach ($array as $objectId => $amount) {
if (!isset($names[$objectId])) {
$object = $repository->find((int)$objectId);
$object = $repository->findNull((int)$objectId);
$names[$objectId] = $object->name ?? $object->tag;
}
$amount = app('steam')->positive($amount);

View File

@ -176,7 +176,7 @@ class CategoryController extends Controller
$cache->addProperty($accounts->pluck('id')->toArray());
$cache->addProperty($category);
if ($cache->has()) {
return $cache->get(); // @codeCoverageIgnore
return response()->json($cache->get());// @codeCoverageIgnore
}
$repository = app(CategoryRepositoryInterface::class);
$expenses = $repository->periodExpenses(new Collection([$category]), $accounts, $start, $end);
@ -237,7 +237,7 @@ class CategoryController extends Controller
$cache->addProperty('chart.category.period.no-cat');
$cache->addProperty($accounts->pluck('id')->toArray());
if ($cache->has()) {
return $cache->get(); // @codeCoverageIgnore
return response()->json($cache->get()); // @codeCoverageIgnore
}
$repository = app(CategoryRepositoryInterface::class);
$expenses = $repository->periodExpensesNoCategory($accounts, $start, $end);

View File

@ -176,15 +176,15 @@ class AutoCompleteController extends Controller
* @param JournalCollectorInterface $collector
* @param TransactionJournal $except
*
* @return JsonResponse|mixed
* @return JsonResponse
*/
public function journalsWithId(JournalCollectorInterface $collector, TransactionJournal $except)
public function journalsWithId(JournalCollectorInterface $collector, TransactionJournal $except): JsonResponse
{
$cache = new CacheProperties;
$cache->addProperty('recent-journals-id');
if ($cache->has()) {
return $cache->get(); // @codeCoverageIgnore
return response()->json($cache->get()); // @codeCoverageIgnore
}
$collector->setLimit(400)->setPage(1);

View File

@ -107,7 +107,7 @@ class ExpenseController extends Controller
try {
$result = view('reports.partials.exp-budgets', compact('together'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
Log::error(sprintf('Could not render category::budget: %s', $e->getMessage()));
$result = 'An error prevented Firefly III from rendering. Apologies.';
}
$cache->store($result);
@ -271,7 +271,7 @@ class ExpenseController extends Controller
try {
$result = view('reports.partials.top-transactions', compact('sorted'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
Log::error(sprintf('Could not render category::topExpense: %s', $e->getMessage()));
$result = 'An error prevented Firefly III from rendering. Apologies.';
}
$cache->store($result);
@ -320,7 +320,7 @@ class ExpenseController extends Controller
try {
$result = view('reports.partials.top-transactions', compact('sorted'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
Log::error(sprintf('Could not render category::topIncome: %s', $e->getMessage()));
$result = 'An error prevented Firefly III from rendering. Apologies.';
}
$cache->store($result);

View File

@ -121,7 +121,7 @@ class Amount
$locale = explode(',', (string)trans('config.locale'));
$locale = array_map('trim', $locale);
setlocale(LC_MONETARY, $locale);
$float = round($amount, $format->decimal_places);
$float = round($amount, 12);
$info = localeconv();
$formatted = number_format($float, (int)$format->decimal_places, $info['mon_decimal_point'], $info['mon_thousands_sep']);