mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 07:38:29 +00:00
Reorder bill chart [skip ci]
This commit is contained in:
@@ -6,6 +6,7 @@ use App;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
@@ -57,7 +58,7 @@ class BillController extends Controller
|
|||||||
$cache->addProperty('bills');
|
$cache->addProperty('bills');
|
||||||
$cache->addProperty('frontpage');
|
$cache->addProperty('frontpage');
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
return Response::json($cache->get()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$bills = $repository->getActiveBills();
|
$bills = $repository->getActiveBills();
|
||||||
@@ -129,6 +130,13 @@ class BillController extends Controller
|
|||||||
// get first transaction or today for start:
|
// get first transaction or today for start:
|
||||||
$results = $repository->getJournals($bill);
|
$results = $repository->getJournals($bill);
|
||||||
|
|
||||||
|
// resort:
|
||||||
|
$results = $results->sortBy(
|
||||||
|
function (TransactionJournal $journal) {
|
||||||
|
return $journal->date->format('U');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$data = $this->generator->single($bill, $results);
|
$data = $this->generator->single($bill, $results);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ class TestDataSeeder extends Seeder
|
|||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'transaction_type_id' => 1,
|
'transaction_type_id' => 1,
|
||||||
'transaction_currency_id' => 1,
|
'transaction_currency_id' => 1,
|
||||||
|
'bill_id' => 1,
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'completed' => 1,
|
'completed' => 1,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
|
|||||||
Reference in New Issue
Block a user