Reorder bill chart [skip ci]

This commit is contained in:
James Cole 2015-07-01 13:18:50 +02:00
parent f28fdf8252
commit fc7d65629a
2 changed files with 10 additions and 1 deletions

View File

@ -6,6 +6,7 @@ use App;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Bill;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Support\CacheProperties;
@ -57,7 +58,7 @@ class BillController extends Controller
$cache->addProperty('bills');
$cache->addProperty('frontpage');
if ($cache->has()) {
return Response::json($cache->get()); // @codeCoverageIgnore
return Response::json($cache->get()); // @codeCoverageIgnore
}
$bills = $repository->getActiveBills();
@ -129,6 +130,13 @@ class BillController extends Controller
// get first transaction or today for start:
$results = $repository->getJournals($bill);
// resort:
$results = $results->sortBy(
function (TransactionJournal $journal) {
return $journal->date->format('U');
}
);
$data = $this->generator->single($bill, $results);
$cache->store($data);

View File

@ -289,6 +289,7 @@ class TestDataSeeder extends Seeder
'user_id' => $this->user->id,
'transaction_type_id' => 1,
'transaction_currency_id' => 1,
'bill_id' => 1,
'description' => $description,
'completed' => 1,
'date' => $date,