Correct ordering (everywhere).

This commit is contained in:
James Cole
2015-03-27 07:32:06 +01:00
parent 30c5376217
commit a83fe2caea
6 changed files with 34 additions and 7 deletions

View File

@@ -87,6 +87,9 @@ class ReportQuery implements ReportQueryInterface
->whereNull('budget_transaction_journal.budget_id')->whereNull('transaction_journals.deleted_at') ->whereNull('budget_transaction_journal.budget_id')->whereNull('transaction_journals.deleted_at')
->whereNull('otherJournals.deleted_at') ->whereNull('otherJournals.deleted_at')
->where('transactions.account_id', $account->id) ->where('transactions.account_id', $account->id)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order','ASC')
->orderBy('transaction_journals.id','DESC')
->whereNotNull('transaction_group_transaction_journal.transaction_group_id') ->whereNotNull('transaction_group_transaction_journal.transaction_group_id')
->get( ->get(
[ [

View File

@@ -138,7 +138,12 @@ class BillController extends Controller
*/ */
public function show(Bill $bill, BillRepositoryInterface $repository) public function show(Bill $bill, BillRepositoryInterface $repository)
{ {
$journals = $bill->transactionjournals()->withRelevantData()->orderBy('date', 'DESC')->get(); $journals = $bill->transactionjournals()->withRelevantData()
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order','ASC')
->orderBy('transaction_journals.id','DESC')
->get();
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill); $bill->nextExpectedMatch = $repository->nextExpectedMatch($bill);
$hideBill = true; $hideBill = true;

View File

@@ -133,7 +133,9 @@ class BudgetController extends Controller
->whereNull('budget_transaction_journal.id') ->whereNull('budget_transaction_journal.id')
->before($end) ->before($end)
->after($start) ->after($start)
->orderBy('transaction_journals.date') ->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order','ASC')
->orderBy('transaction_journals.id','DESC')
->get(['transaction_journals.*']); ->get(['transaction_journals.*']);
$subTitle = 'Transactions without a budget in ' . $start->format('F Y'); $subTitle = 'Transactions without a budget in ' . $start->format('F Y');

View File

@@ -88,7 +88,11 @@ class CategoryController extends Controller
$categories->each( $categories->each(
function (Category $category) { function (Category $category) {
$latest = $category->transactionjournals()->orderBy('date', 'DESC')->first(); $latest = $category->transactionjournals()
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order','ASC')
->orderBy('transaction_journals.id','DESC')
->first();
if ($latest) { if ($latest) {
$category->lastActivity = $latest->date; $category->lastActivity = $latest->date;
} }
@@ -111,7 +115,9 @@ class CategoryController extends Controller
->whereNull('category_transaction_journal.id') ->whereNull('category_transaction_journal.id')
->before($end) ->before($end)
->after($start) ->after($start)
->orderBy('transaction_journals.date') ->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order','ASC')
->orderBy('transaction_journals.id','DESC')
->get(['transaction_journals.*']); ->get(['transaction_journals.*']);
$subTitle = 'Transactions without a category between ' . $start->format('jS F Y') . ' and ' . $end->format('jS F Y'); $subTitle = 'Transactions without a category between ' . $start->format('jS F Y') . ' and ' . $end->format('jS F Y');
@@ -129,7 +135,13 @@ class CategoryController extends Controller
$hideCategory = true; // used in list. $hideCategory = true; // used in list.
$page = intval(Input::get('page')); $page = intval(Input::get('page'));
$offset = $page > 0 ? $page * 50 : 0; $offset = $page > 0 ? $page * 50 : 0;
$set = $category->transactionJournals()->withRelevantData()->take(50)->offset($offset)->orderBy('date', 'DESC')->get( $set = $category->transactionJournals()->withRelevantData()->take(50)->offset($offset)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order','ASC')
->orderBy('transaction_journals.id','DESC')
->get(
['transaction_journals.*'] ['transaction_journals.*']
); );
$count = $category->transactionJournals()->count(); $count = $category->transactionJournals()->count();

View File

@@ -106,7 +106,9 @@ class AccountRepository implements AccountRepositoryInterface
->withRelevantData() ->withRelevantData()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id) ->where('transactions.account_id', $account->id)
->orderBy('date', 'DESC'); ->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order','ASC')
->orderBy('transaction_journals.id','DESC');
$query->before(Session::get('end', Carbon::now()->endOfMonth())); $query->before(Session::get('end', Carbon::now()->endOfMonth()));
$query->after(Session::get('start', Carbon::now()->startOfMonth())); $query->after(Session::get('start', Carbon::now()->startOfMonth()));

View File

@@ -42,7 +42,10 @@ class BudgetRepository implements BudgetRepositoryInterface
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $take : 0; $offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $take : 0;
$setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)->orderBy('date', 'DESC'); $setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order','ASC')
->orderBy('transaction_journals.id','DESC');
$countQuery = $budget->transactionJournals(); $countQuery = $budget->transactionJournals();