mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 00:20:03 +00:00
make sure reports work as expected.
This commit is contained in:
@@ -24,7 +24,7 @@ namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Http\Requests\BillFormRequest;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Bill;
|
||||
@@ -124,7 +124,7 @@ class BillController extends Controller
|
||||
* Destroy a bill.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
@@ -143,7 +143,7 @@ class BillController extends Controller
|
||||
* Edit a bill.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
@@ -232,7 +232,7 @@ class BillController extends Controller
|
||||
* Rescan bills for transactions.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
@@ -269,7 +269,7 @@ class BillController extends Controller
|
||||
* Show a bill.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
@@ -304,13 +304,12 @@ class BillController extends Controller
|
||||
$object = $manager->createData($resource)->toArray();
|
||||
$object['data']['currency'] = $bill->transactionCurrency;
|
||||
|
||||
// use collector:
|
||||
/** @var TransactionCollectorInterface $collector */
|
||||
$collector = app(TransactionCollectorInterface::class);
|
||||
$collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page)->withBudgetInformation()
|
||||
->withCategoryInformation();
|
||||
$transactions = $collector->getPaginatedTransactions();
|
||||
$transactions->setPath(route('bills.show', [$bill->id]));
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setBill($bill)->setLimit($pageSize)->setPage($page)->withBudgetInformation()
|
||||
->withCategoryInformation()->withAccountInformation();
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('bills.show', [$bill->id]));
|
||||
|
||||
// transform any attachments as well.
|
||||
$collection = $this->billRepository->getAttachments($bill);
|
||||
@@ -326,7 +325,7 @@ class BillController extends Controller
|
||||
}
|
||||
|
||||
|
||||
return view('bills.show', compact('attachments', 'transactions', 'rules', 'yearAverage', 'overallAverage', 'year', 'object', 'bill', 'subTitle'));
|
||||
return view('bills.show', compact('attachments', 'groups', 'rules', 'yearAverage', 'overallAverage', 'year', 'object', 'bill', 'subTitle'));
|
||||
}
|
||||
|
||||
|
||||
@@ -368,7 +367,7 @@ class BillController extends Controller
|
||||
* Update a bill.
|
||||
*
|
||||
* @param BillFormRequest $request
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
|
||||
@@ -152,7 +152,7 @@ class BudgetReportController extends Controller
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
//return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
$format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
|
||||
$function = app('navigation')->preferredEndOfPeriod($start, $end);
|
||||
|
||||
@@ -207,7 +207,7 @@ class CategoryReportController extends Controller
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
//return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
|
||||
@@ -261,7 +261,7 @@ class CategoryReportController extends Controller
|
||||
$labelOut = $category->id . '-out';
|
||||
$labelSumIn = $category->id . '-total-in';
|
||||
$labelSumOut = $category->id . '-total-out';
|
||||
$currentIncome = $income[$category->id] ?? '0';
|
||||
$currentIncome = bcmul($income[$category->id] ?? '0','-1');
|
||||
$currentExpense = $expenses[$category->id] ?? '0';
|
||||
|
||||
// add to sum:
|
||||
@@ -279,6 +279,7 @@ class CategoryReportController extends Controller
|
||||
/** @var Carbon $currentStart */
|
||||
$currentStart = clone $currentEnd;
|
||||
$currentStart->addDay();
|
||||
$currentStart->startOfDay();
|
||||
}
|
||||
// remove all empty entries to prevent cluttering:
|
||||
$newSet = [];
|
||||
@@ -287,7 +288,7 @@ class CategoryReportController extends Controller
|
||||
$newSet[$key] = $chartData[$key];
|
||||
}
|
||||
}
|
||||
if (0 === \count($newSet)) {
|
||||
if (0 === count($newSet)) {
|
||||
$newSet = $chartData;
|
||||
}
|
||||
$data = $this->generator->multiSet($newSet);
|
||||
|
||||
@@ -23,9 +23,9 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Events\RequestedVersionCheckStatus;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
||||
use FireflyIII\Http\Middleware\Installer;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@@ -35,7 +35,7 @@ use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class HomeController.
|
||||
*/
|
||||
@@ -56,8 +56,8 @@ class HomeController extends Controller
|
||||
* Change index date range.
|
||||
*
|
||||
* @param Request $request
|
||||
* @throws Exception
|
||||
* @return JsonResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public function dateRange(Request $request): JsonResponse
|
||||
{
|
||||
@@ -97,8 +97,8 @@ class HomeController extends Controller
|
||||
* Show index.
|
||||
*
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @throws Exception
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
* @throws Exception
|
||||
*/
|
||||
public function index(AccountRepositoryInterface $repository)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user