mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
🤖 Auto commit for release 'develop' on 2025-08-01
This commit is contained in:
@@ -28,7 +28,6 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
@@ -43,13 +42,13 @@ class FrontpageController extends Controller
|
||||
*/
|
||||
public function piggyBanks(PiggyBankRepositoryInterface $repository): JsonResponse
|
||||
{
|
||||
$set = $repository->getPiggyBanks();
|
||||
$info = [];
|
||||
$set = $repository->getPiggyBanks();
|
||||
$info = [];
|
||||
|
||||
|
||||
/** @var PiggyBank $piggyBank */
|
||||
foreach ($set as $piggyBank) {
|
||||
$amount = $repository->getCurrentAmount($piggyBank);
|
||||
$amount = $repository->getCurrentAmount($piggyBank);
|
||||
$pcAmount = $repository->getCurrentPrimaryCurrencyAmount($piggyBank);
|
||||
if (1 === bccomp($amount, '0')) {
|
||||
// percentage!
|
||||
@@ -59,16 +58,16 @@ class FrontpageController extends Controller
|
||||
}
|
||||
|
||||
$entry = [
|
||||
'id' => $piggyBank->id,
|
||||
'name' => $piggyBank->name,
|
||||
'amount' => $amount,
|
||||
'pc_amount' => $pcAmount,
|
||||
'target' => $piggyBank->target_amount,
|
||||
'pc_target' => $piggyBank->native_target_amount,
|
||||
'percentage' => $pct,
|
||||
'id' => $piggyBank->id,
|
||||
'name' => $piggyBank->name,
|
||||
'amount' => $amount,
|
||||
'pc_amount' => $pcAmount,
|
||||
'target' => $piggyBank->target_amount,
|
||||
'pc_target' => $piggyBank->native_target_amount,
|
||||
'percentage' => $pct,
|
||||
// currency:
|
||||
'currency_symbol' => $piggyBank->transactionCurrency->symbol,
|
||||
'currency_decimal_places' => $piggyBank->transactionCurrency->decimal_places,
|
||||
'currency_symbol' => $piggyBank->transactionCurrency->symbol,
|
||||
'currency_decimal_places' => $piggyBank->transactionCurrency->decimal_places,
|
||||
'primary_currency_symbol' => $this->primaryCurrency->symbol,
|
||||
'primary_currency_decimal_places' => $this->primaryCurrency->decimal_places,
|
||||
|
||||
@@ -84,12 +83,12 @@ class FrontpageController extends Controller
|
||||
static fn (array $a, array $b) => $a['percentage'] <=> $b['percentage']
|
||||
);
|
||||
|
||||
$html = '';
|
||||
$html = '';
|
||||
if (0 !== count($info)) {
|
||||
try {
|
||||
$convertToPrimary = $this->convertToPrimary;
|
||||
$primary = $this->primaryCurrency;
|
||||
$html = view('json.piggy-banks', compact('info', 'convertToPrimary', 'primary'))->render();
|
||||
$primary = $this->primaryCurrency;
|
||||
$html = view('json.piggy-banks', compact('info', 'convertToPrimary', 'primary'))->render();
|
||||
} catch (Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
|
Reference in New Issue
Block a user