mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Bug fixes in strict types.
This commit is contained in:
@@ -175,7 +175,7 @@ class PiggyBankController extends Controller
|
|||||||
foreach ($piggyBanks as $piggyBank) {
|
foreach ($piggyBanks as $piggyBank) {
|
||||||
$piggyBank->savedSoFar = round($piggyBank->currentRelevantRep()->currentamount, 2);
|
$piggyBank->savedSoFar = round($piggyBank->currentRelevantRep()->currentamount, 2);
|
||||||
$piggyBank->percentage = $piggyBank->savedSoFar != 0 ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0;
|
$piggyBank->percentage = $piggyBank->savedSoFar != 0 ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0;
|
||||||
$piggyBank->leftToSave = bcsub($piggyBank->targetamount, $piggyBank->savedSoFar);
|
$piggyBank->leftToSave = bcsub($piggyBank->targetamount, strval($piggyBank->savedSoFar));
|
||||||
$piggyBank->percentage = $piggyBank->percentage > 100 ? 100 : $piggyBank->percentage;
|
$piggyBank->percentage = $piggyBank->percentage > 100 ? 100 : $piggyBank->percentage;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -192,7 +192,7 @@ class PiggyBankController extends Controller
|
|||||||
'leftToSave' => $piggyBank->leftToSave,
|
'leftToSave' => $piggyBank->leftToSave,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], $piggyBank->savedSoFar);
|
$accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], strval($piggyBank->savedSoFar));
|
||||||
$accounts[$account->id]['sumOfTargets'] = bcadd($accounts[$account->id]['sumOfTargets'], $piggyBank->targetamount);
|
$accounts[$account->id]['sumOfTargets'] = bcadd($accounts[$account->id]['sumOfTargets'], $piggyBank->targetamount);
|
||||||
$accounts[$account->id]['leftToSave'] = bcadd($accounts[$account->id]['leftToSave'], $piggyBank->leftToSave);
|
$accounts[$account->id]['leftToSave'] = bcadd($accounts[$account->id]['leftToSave'], $piggyBank->leftToSave);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MassController.php
|
* MassController.php
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
@@ -7,11 +9,8 @@
|
|||||||
* of the MIT license. See the LICENSE file for details.
|
* of the MIT license. See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare(strict_types = 1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Transaction;
|
namespace FireflyIII\Http\Controllers\Transaction;
|
||||||
|
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use ExpandedForm;
|
use ExpandedForm;
|
||||||
|
|||||||
@@ -40,19 +40,12 @@ class CrudServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->app->bind(
|
$this->registerJournal();
|
||||||
'FireflyIII\Crud\Split\JournalInterface',
|
$this->registerAccount();
|
||||||
function (Application $app, array $arguments) {
|
}
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
|
||||||
return app('FireflyIII\Crud\Split\Journal', [$app->auth->user()]);
|
|
||||||
}
|
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
|
||||||
throw new FireflyException('There is no user present.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return app('FireflyIII\Crud\Split\Journal', $arguments);
|
private function registerAccount()
|
||||||
}
|
{
|
||||||
);
|
|
||||||
|
|
||||||
$this->app->bind(
|
$this->app->bind(
|
||||||
'FireflyIII\Crud\Account\AccountCrudInterface',
|
'FireflyIII\Crud\Account\AccountCrudInterface',
|
||||||
@@ -68,4 +61,22 @@ class CrudServiceProvider extends ServiceProvider
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function registerJournal()
|
||||||
|
{
|
||||||
|
$this->app->bind(
|
||||||
|
'FireflyIII\Crud\Split\JournalInterface',
|
||||||
|
function (Application $app, array $arguments) {
|
||||||
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
|
return app('FireflyIII\Crud\Split\Journal', [$app->auth->user()]);
|
||||||
|
}
|
||||||
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
|
throw new FireflyException('There is no user present.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return app('FireflyIII\Crud\Split\Journal', $arguments);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
$balance = Steam::balanceIgnoreVirtual($account, $date);
|
$balance = Steam::balanceIgnoreVirtual($account, $date);
|
||||||
/** @var PiggyBank $p */
|
/** @var PiggyBank $p */
|
||||||
foreach ($account->piggybanks()->get() as $p) {
|
foreach ($account->piggybanks()->get() as $p) {
|
||||||
$balance -= $p->currentRelevantRep()->currentamount;
|
$balance = bcsub($balance, $p->currentRelevantRep()->currentamount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $balance;
|
return $balance;
|
||||||
|
|||||||
Reference in New Issue
Block a user