mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-16 18:25:00 -06:00
Change in parameter and code cleanup.
This commit is contained in:
parent
c1107fe854
commit
58848caf30
26
.ci/php-cs-fixer/composer.lock
generated
26
.ci/php-cs-fixer/composer.lock
generated
@ -8,16 +8,16 @@
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/pcre",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/pcre.git",
|
||||
"reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2"
|
||||
"reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2",
|
||||
"reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2",
|
||||
"url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9",
|
||||
"reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -59,7 +59,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/pcre/issues",
|
||||
"source": "https://github.com/composer/pcre/tree/3.1.0"
|
||||
"source": "https://github.com/composer/pcre/tree/3.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -75,7 +75,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-17T09:50:14+00:00"
|
||||
"time": "2023-10-11T07:11:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/semver",
|
||||
@ -226,16 +226,16 @@
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
"version": "v3.34.1",
|
||||
"version": "v3.35.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||
"reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3"
|
||||
"reference": "ec1ccc264994b6764882669973ca435cf05bab08"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3",
|
||||
"reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ec1ccc264994b6764882669973ca435cf05bab08",
|
||||
"reference": "ec1ccc264994b6764882669973ca435cf05bab08",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -268,8 +268,6 @@
|
||||
"phpspec/prophecy": "^1.16",
|
||||
"phpspec/prophecy-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"phpunitgoodpractices/polyfill": "^1.6",
|
||||
"phpunitgoodpractices/traits": "^1.9.2",
|
||||
"symfony/phpunit-bridge": "^6.2.3",
|
||||
"symfony/yaml": "^5.4 || ^6.0"
|
||||
},
|
||||
@ -309,7 +307,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.1"
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.35.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -317,7 +315,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-10-03T23:51:05+00:00"
|
||||
"time": "2023-10-12T13:47:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
|
@ -82,7 +82,8 @@ class AccountController extends Controller
|
||||
$date = $data['date'] ?? today(config('app.timezone'));
|
||||
|
||||
$return = [];
|
||||
$result = $this->repository->searchAccount((string)$query, $types, $data['limit']);
|
||||
|
||||
$result = $this->repository->searchAccount((string)$query, $types, $this->parameters->get('limit'));
|
||||
// TODO this code is duplicated in the V2 Autocomplete controller, which means this code is due to be deprecated.
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
|
||||
|
@ -58,7 +58,6 @@ class BillController extends Controller
|
||||
/**
|
||||
* Documentation for this endpoint is at:
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getBillsAC
|
||||
* TODO expand API to add active field.
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
@ -67,7 +66,7 @@ class BillController extends Controller
|
||||
public function bills(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$result = $this->repository->searchBill($data['query'], $data['limit']);
|
||||
$result = $this->repository->searchBill($data['query'], $this->parameters->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static function (Bill $item) {
|
||||
return [
|
||||
|
@ -66,7 +66,7 @@ class BudgetController extends Controller
|
||||
public function budgets(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$result = $this->repository->searchBudget($data['query'], $data['limit']);
|
||||
$result = $this->repository->searchBudget($data['query'], $this->parameters->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static function (Budget $item) {
|
||||
return [
|
||||
|
@ -66,7 +66,7 @@ class CategoryController extends Controller
|
||||
public function categories(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$result = $this->repository->searchCategory($data['query'], $data['limit']);
|
||||
$result = $this->repository->searchCategory($data['query'], $this->parameters->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static function (Category $item) {
|
||||
return [
|
||||
|
@ -66,7 +66,7 @@ class CurrencyController extends Controller
|
||||
public function currencies(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$collection = $this->repository->searchCurrency($data['query'], $data['limit']);
|
||||
$collection = $this->repository->searchCurrency($data['query'], $this->parameters->get('limit'));
|
||||
$result = [];
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
@ -95,7 +95,7 @@ class CurrencyController extends Controller
|
||||
public function currenciesWithCode(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$collection = $this->repository->searchCurrency($data['query'], $data['limit']);
|
||||
$collection = $this->repository->searchCurrency($data['query'], $this->parameters->get('limit'));
|
||||
$result = [];
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
|
@ -67,7 +67,7 @@ class ObjectGroupController extends Controller
|
||||
{
|
||||
$data = $request->getData();
|
||||
$return = [];
|
||||
$result = $this->repository->search($data['query'], $data['limit']);
|
||||
$result = $this->repository->search($data['query'], $this->parameters->get('limit'));
|
||||
|
||||
/** @var ObjectGroup $objectGroup */
|
||||
foreach ($result as $objectGroup) {
|
||||
|
@ -70,7 +70,7 @@ class PiggyBankController extends Controller
|
||||
public function piggyBanks(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$piggies = $this->piggyRepository->searchPiggyBank($data['query'], $data['limit']);
|
||||
$piggies = $this->piggyRepository->searchPiggyBank($data['query'], $this->parameters->get('limit'));
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
$response = [];
|
||||
|
||||
@ -105,7 +105,7 @@ class PiggyBankController extends Controller
|
||||
public function piggyBanksWithBalance(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$piggies = $this->piggyRepository->searchPiggyBank($data['query'], $data['limit']);
|
||||
$piggies = $this->piggyRepository->searchPiggyBank($data['query'], $this->parameters->get('limit'));
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
$response = [];
|
||||
/** @var PiggyBank $piggy */
|
||||
|
@ -64,7 +64,7 @@ class RecurrenceController extends Controller
|
||||
public function recurring(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$recurrences = $this->repository->searchRecurrence($data['query'], $data['limit']);
|
||||
$recurrences = $this->repository->searchRecurrence($data['query'], $this->parameters->get('limit'));
|
||||
$response = [];
|
||||
|
||||
/** @var Recurrence $recurrence */
|
||||
|
@ -63,7 +63,7 @@ class RuleController extends Controller
|
||||
public function rules(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$rules = $this->repository->searchRule($data['query'], $data['limit']);
|
||||
$rules = $this->repository->searchRule($data['query'], $this->parameters->get('limit'));
|
||||
$response = [];
|
||||
|
||||
/** @var Rule $rule */
|
||||
|
@ -63,7 +63,7 @@ class RuleGroupController extends Controller
|
||||
public function ruleGroups(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$groups = $this->repository->searchRuleGroup($data['query'], $data['limit']);
|
||||
$groups = $this->repository->searchRuleGroup($data['query'], $this->parameters->get('limit'));
|
||||
$response = [];
|
||||
|
||||
/** @var RuleGroup $group */
|
||||
|
@ -67,7 +67,7 @@ class TagController extends Controller
|
||||
{
|
||||
$data = $request->getData();
|
||||
|
||||
$result = $this->repository->searchTags($data['query'], $data['limit']);
|
||||
$result = $this->repository->searchTags($data['query'], $this->parameters->get('limit'));
|
||||
$array = [];
|
||||
/** @var Tag $tag */
|
||||
foreach ($result as $tag) {
|
||||
|
@ -71,7 +71,7 @@ class TransactionController extends Controller
|
||||
public function transactions(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
|
||||
$result = $this->repository->searchJournalDescriptions($data['query'], $this->parameters->get('limit'));
|
||||
|
||||
// limit and unique
|
||||
$filtered = $result->unique('description');
|
||||
@ -113,7 +113,7 @@ class TransactionController extends Controller
|
||||
}
|
||||
}
|
||||
if (!is_numeric($data['query'])) {
|
||||
$result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
|
||||
$result = $this->repository->searchJournalDescriptions($data['query'], $this->parameters->get('limit'));
|
||||
}
|
||||
|
||||
// limit and unique
|
||||
|
@ -62,7 +62,7 @@ class TransactionTypeController extends Controller
|
||||
public function transactionTypes(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$types = $this->repository->searchTypes($data['query'], $data['limit']);
|
||||
$types = $this->repository->searchTypes($data['query'], $this->parameters->get('limit'));
|
||||
$array = [];
|
||||
|
||||
/** @var TransactionType $type */
|
||||
|
@ -236,6 +236,7 @@ class BasicController extends Controller
|
||||
*/
|
||||
private function getBillInformation(Carbon $start, Carbon $end): array
|
||||
{
|
||||
app('log')->debug(sprintf('Now in getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));
|
||||
/*
|
||||
* Since both this method and the chart use the exact same data, we can suffice
|
||||
* with calling the one method in the bill repository that will get this amount.
|
||||
@ -281,7 +282,7 @@ class BasicController extends Controller
|
||||
'sub_title' => '',
|
||||
];
|
||||
}
|
||||
|
||||
app('log')->debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,6 @@ class AutocompleteRequest extends FormRequest
|
||||
if ('' !== $types) {
|
||||
$array = explode(',', $types);
|
||||
}
|
||||
$limit = $this->convertInteger('limit');
|
||||
$limit = 0 === $limit ? 10 : $limit;
|
||||
|
||||
// remove 'initial balance' from allowed types. its internal
|
||||
$array = array_diff($array, [AccountType::INITIAL_BALANCE, AccountType::RECONCILIATION]);
|
||||
@ -56,7 +54,6 @@ class AutocompleteRequest extends FormRequest
|
||||
'types' => $array,
|
||||
'query' => $this->convertString('query'),
|
||||
'date' => $this->getCarbonDate('date'),
|
||||
'limit' => $limit,
|
||||
];
|
||||
}
|
||||
|
||||
@ -66,7 +63,6 @@ class AutocompleteRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'limit' => 'min:0|max:1337',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,9 @@ class JournalServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*/
|
||||
public function boot(): void {}
|
||||
public function boot(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
|
@ -665,13 +665,17 @@ class BillRepository implements BillRepositoryInterface
|
||||
*/
|
||||
public function sumUnpaidInRange(Carbon $start, Carbon $end): array
|
||||
{
|
||||
app('log')->debug(sprintf('Now in sumUnpaidInRange("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
$bills = $this->getActiveBills();
|
||||
$return = [];
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
app('log')->debug(sprintf('Processing bill #%d ("%s")', $bill->id, $bill->name));
|
||||
$dates = $this->getPayDatesInRange($bill, $start, $end);
|
||||
$count = $bill->transactionJournals()->after($start)->before($end)->count();
|
||||
$total = $dates->count() - $count;
|
||||
app('log')->debug(sprintf('Pay dates: %d, count: %d, left: %d', $dates->count(), $count, $total));
|
||||
app('log')->debug('dates', $dates->toArray());
|
||||
|
||||
if ($total > 0) {
|
||||
$currency = $bill->transactionCurrency;
|
||||
|
@ -323,15 +323,15 @@ class Steam
|
||||
$balances[$format] = $currentBalance;
|
||||
|
||||
app('log')->debug(sprintf(
|
||||
'%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
|
||||
$format,
|
||||
$currency->code,
|
||||
$rate,
|
||||
$currency->code,
|
||||
$transaction['amount'],
|
||||
$native->code,
|
||||
$convertedAmount
|
||||
));
|
||||
'%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
|
||||
$format,
|
||||
$currency->code,
|
||||
$rate,
|
||||
$currency->code,
|
||||
$transaction['amount'],
|
||||
$native->code,
|
||||
$convertedAmount
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user