Fix issues with available budgets.

This commit is contained in:
James Cole 2024-02-29 06:26:23 +01:00
parent e0a89bb5fe
commit a0097bd613
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
3 changed files with 32 additions and 33 deletions

View File

@ -226,16 +226,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.50.0",
"version": "v3.51.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "dbea11dcb6d9a1f6c8d51c0e580ab4a8876f524c"
"reference": "127fa74f010da99053e3f5b62672615b72dd6efd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/dbea11dcb6d9a1f6c8d51c0e580ab4a8876f524c",
"reference": "dbea11dcb6d9a1f6c8d51c0e580ab4a8876f524c",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/127fa74f010da99053e3f5b62672615b72dd6efd",
"reference": "127fa74f010da99053e3f5b62672615b72dd6efd",
"shasum": ""
},
"require": {
@ -306,7 +306,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.50.0"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.51.0"
},
"funding": [
{
@ -314,7 +314,7 @@
"type": "github"
}
],
"time": "2024-02-23T23:17:45+00:00"
"time": "2024-02-28T19:50:06+00:00"
},
{
"name": "psr/container",
@ -538,16 +538,16 @@
},
{
"name": "symfony/console",
"version": "v7.0.3",
"version": "v7.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "c5010d50f1ee4b25cfa0201d9915cf1b14071456"
"reference": "6b099f3306f7c9c2d2786ed736d0026b2903205f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/c5010d50f1ee4b25cfa0201d9915cf1b14071456",
"reference": "c5010d50f1ee4b25cfa0201d9915cf1b14071456",
"url": "https://api.github.com/repos/symfony/console/zipball/6b099f3306f7c9c2d2786ed736d0026b2903205f",
"reference": "6b099f3306f7c9c2d2786ed736d0026b2903205f",
"shasum": ""
},
"require": {
@ -611,7 +611,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.0.3"
"source": "https://github.com/symfony/console/tree/v7.0.4"
},
"funding": [
{
@ -627,7 +627,7 @@
"type": "tidelift"
}
],
"time": "2024-01-23T15:02:46+00:00"
"time": "2024-02-22T20:27:20+00:00"
},
{
"name": "symfony/deprecation-contracts",
@ -1522,16 +1522,16 @@
},
{
"name": "symfony/process",
"version": "v7.0.3",
"version": "v7.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "937a195147e0c27b2759ade834169ed006d0bc74"
"reference": "0e7727191c3b71ebec6d529fa0e50a01ca5679e9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/937a195147e0c27b2759ade834169ed006d0bc74",
"reference": "937a195147e0c27b2759ade834169ed006d0bc74",
"url": "https://api.github.com/repos/symfony/process/zipball/0e7727191c3b71ebec6d529fa0e50a01ca5679e9",
"reference": "0e7727191c3b71ebec6d529fa0e50a01ca5679e9",
"shasum": ""
},
"require": {
@ -1563,7 +1563,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v7.0.3"
"source": "https://github.com/symfony/process/tree/v7.0.4"
},
"funding": [
{
@ -1579,7 +1579,7 @@
"type": "tidelift"
}
],
"time": "2024-01-23T15:02:46+00:00"
"time": "2024-02-22T20:27:20+00:00"
},
{
"name": "symfony/service-contracts",
@ -1727,16 +1727,16 @@
},
{
"name": "symfony/string",
"version": "v7.0.3",
"version": "v7.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "524aac4a280b90a4420d8d6a040718d0586505ac"
"reference": "f5832521b998b0bec40bee688ad5de98d4cf111b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/524aac4a280b90a4420d8d6a040718d0586505ac",
"reference": "524aac4a280b90a4420d8d6a040718d0586505ac",
"url": "https://api.github.com/repos/symfony/string/zipball/f5832521b998b0bec40bee688ad5de98d4cf111b",
"reference": "f5832521b998b0bec40bee688ad5de98d4cf111b",
"shasum": ""
},
"require": {
@ -1793,7 +1793,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v7.0.3"
"source": "https://github.com/symfony/string/tree/v7.0.4"
},
"funding": [
{
@ -1809,7 +1809,7 @@
"type": "tidelift"
}
],
"time": "2024-01-29T15:41:16+00:00"
"time": "2024-02-01T13:17:36+00:00"
}
],
"packages-dev": [],

View File

@ -116,7 +116,6 @@ class IndexController extends Controller
// get all available budgets:
$availableBudgets = $this->getAllAvailableBudgets($start, $end);
// get all active budgets:
$budgets = $this->getAllBudgets($start, $end, $currencies, $defaultCurrency);
$sums = $this->getSums($budgets);

View File

@ -66,8 +66,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
if (null !== $start && null !== $end) {
$query->where(
static function (Builder $q1) use ($start, $end): void { // @phpstan-ignore-line
$q1->where('start_date', '=', $start);
$q1->where('end_date', '=', $end);
$q1->where('start_date', '=', $start->format('Y-m-d'));
$q1->where('end_date', '=', $end->format('Y-m-d'));
}
);
}
@ -201,8 +201,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
$availableBudget = new AvailableBudget();
$availableBudget->user()->associate($this->user);
$availableBudget->transactionCurrency()->associate($currency);
$availableBudget->start_date = $start->startOfDay();
$availableBudget->end_date = $end->endOfDay();
$availableBudget->start_date = $start->startOfDay()->format('Y-m-d');
$availableBudget->end_date = $end->endOfDay()->format('Y-m-d');
}
$availableBudget->amount = $amount;
$availableBudget->save();
@ -234,8 +234,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
'user_group_id' => $this->user->user_group_id,
'transaction_currency_id' => $data['currency_id'],
'amount' => $data['amount'],
'start_date' => $start,
'end_date' => $end,
'start_date' => $start->format('Y-m-d'),
'end_date' => $end->format('Y-m-d'),
]
);
}
@ -256,7 +256,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
$start = $data['start'];
if ($start instanceof Carbon) {
$start = $data['start']->startOfDay();
$availableBudget->start_date = $start;
$availableBudget->start_date = $start->format('Y-m-d');
$availableBudget->save();
}
}
@ -265,7 +265,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
$end = $data['end'];
if ($end instanceof Carbon) {
$end = $data['end']->endOfDay();
$availableBudget->end_date = $end;
$availableBudget->end_date = $end->format('Y-m-d');
$availableBudget->save();
}
}