Various code clean up.

This commit is contained in:
James Cole
2017-06-07 07:38:58 +02:00
parent 51ddcd9ee1
commit e5db5a7b5c
8 changed files with 20 additions and 17 deletions

View File

@@ -183,6 +183,7 @@ class BudgetController extends Controller
$start = new Carbon($moment); $start = new Carbon($moment);
$end = Navigation::endOfPeriod($start, $range); $end = Navigation::endOfPeriod($start, $range);
} catch (Exception $e) { } catch (Exception $e) {
// start and end are already defined.
} }
} }

View File

@@ -349,7 +349,7 @@ class AccountController extends Controller
$cache->addProperty('chart.account.period'); $cache->addProperty('chart.account.period');
$cache->addProperty($account->id); $cache->addProperty($account->id);
if ($cache->has()) { if ($cache->has()) {
//return Response::json($cache->get()); // @codeCoverageIgnore return Response::json($cache->get()); // @codeCoverageIgnore
} }
$format = (string)trans('config.month_and_day'); $format = (string)trans('config.month_and_day');

View File

@@ -174,14 +174,17 @@ class ConvertController extends Controller
switch ($joined) { switch ($joined) {
default: default:
throw new FireflyException('Cannot handle ' . $joined); // @codeCoverageIgnore throw new FireflyException('Cannot handle ' . $joined); // @codeCoverageIgnore
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT: // one case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT:
// one
$destination = $sourceAccount; $destination = $sourceAccount;
break; break;
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER: // two case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER:
// two
$destination = $accountRepository->find(intval($data['destination_account_asset'])); $destination = $accountRepository->find(intval($data['destination_account_asset']));
break; break;
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL: // three case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL:
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL: // five case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL:
// three and five
if ($data['destination_account_expense'] === '') { if ($data['destination_account_expense'] === '') {
// destination is a cash account. // destination is a cash account.
$destination = $accountRepository->getCashAccount(); $destination = $accountRepository->getCashAccount();
@@ -197,8 +200,9 @@ class ConvertController extends Controller
]; ];
$destination = $accountRepository->store($data); $destination = $accountRepository->store($data);
break; break;
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER: // four case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER:
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT: // six case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT:
// four and six
$destination = $destinationAccount; $destination = $destinationAccount;
break; break;
} }

View File

@@ -53,7 +53,7 @@ class Search implements SearchInterface
public function __construct() public function __construct()
{ {
$this->modifiers = new Collection; $this->modifiers = new Collection;
$this->validModifiers = config('firefly.search_modifiers'); $this->validModifiers = (array) config('firefly.search_modifiers');
} }
/** /**

View File

@@ -135,7 +135,7 @@ class Steam
$cache->addProperty($start); $cache->addProperty($start);
$cache->addProperty($end); $cache->addProperty($end);
if ($cache->has()) { if ($cache->has()) {
//return $cache->get(); // @codeCoverageIgnore return $cache->get(); // @codeCoverageIgnore
} }
$start->subDay(); $start->subDay();
@@ -167,10 +167,6 @@ class Steam
] ]
); );
// echo '<pre>';
// var_dump($set->toArray());
// exit;
$currentBalance = $startBalance; $currentBalance = $startBalance;
/** @var Transaction $entry */ /** @var Transaction $entry */
foreach ($set as $entry) { foreach ($set as $entry) {
@@ -217,7 +213,7 @@ class Steam
$cache->addProperty('balances'); $cache->addProperty('balances');
$cache->addProperty($date); $cache->addProperty($date);
if ($cache->has()) { if ($cache->has()) {
//return $cache->get(); // @codeCoverageIgnore return $cache->get(); // @codeCoverageIgnore
} }
// need to do this per account. // need to do this per account.

View File

@@ -8,7 +8,7 @@
* See the LICENSE file for details. * See the LICENSE file for details.
*/ */
/** global: budgetChartUri, expenseCategoryUri, expenseAssetUri, expenseExpenseUri */ /** global: budgetChartUri, expenseCategoryUri, expenseAssetUri, expenseExpenseUri, budgetLimitID */
$(function () { $(function () {
"use strict"; "use strict";

View File

@@ -32,8 +32,6 @@ $(document).ready(function () {
*/ */
function updateInitialPage() { function updateInitialPage() {
console.log('Native currency is #' + journalData.native_currency.id + ' and (foreign) currency id is #' + journalData.currency.id);
if (journal.transaction_type.type === "Transfer") { if (journal.transaction_type.type === "Transfer") {
$('#native_amount_holder').hide(); $('#native_amount_holder').hide();
$('#amount_holder').hide(); $('#amount_holder').hide();

View File

@@ -87,6 +87,10 @@ then
# call test data generation script # call test data generation script
$(which php) /sites/FF3/test-data/artisan generate:data local sqlite $(which php) /sites/FF3/test-data/artisan generate:data local sqlite
# also run upgrade routine:
$(which php) /sites/FF3/firefly-iii/artisan firefly:upgrade-database
# copy new database over backup (resets backup) # copy new database over backup (resets backup)
cp $DATABASE $DATABASECOPY cp $DATABASE $DATABASECOPY
fi fi