Add additional eager loading annotations
This commit is contained in:
parent
39aff78f11
commit
1550eedb5a
6 changed files with 9 additions and 9 deletions
|
@ -3,7 +3,7 @@ class Admin::FinancesController < Admin::BaseController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@bank_accounts = BankAccount.order('name')
|
@bank_accounts = BankAccount.order('name')
|
||||||
@financial_transaction_classes = FinancialTransactionClass.order('name ASC')
|
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_bank_accounts
|
def update_bank_accounts
|
||||||
|
@ -12,7 +12,7 @@ class Admin::FinancesController < Admin::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_transaction_types
|
def update_transaction_types
|
||||||
@financial_transaction_classes = FinancialTransactionClass.order('name ASC')
|
@financial_transaction_classes = FinancialTransactionClass.includes(:financial_transaction_types).order('name ASC')
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Finance::BankTransactionsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
@bank_account = BankAccount.find(params[:bank_account_id])
|
@bank_account = BankAccount.find(params[:bank_account_id])
|
||||||
@bank_transactions = @bank_account.bank_transactions.order(sort)
|
@bank_transactions = @bank_account.bank_transactions.order(sort).includes(:financial_link)
|
||||||
@bank_transactions = @bank_transactions.where('reference LIKE ? OR text LIKE ?', "%#{params[:query]}%", "%#{params[:query]}%") unless params[:query].nil?
|
@bank_transactions = @bank_transactions.where('reference LIKE ? OR text LIKE ?', "%#{params[:query]}%", "%#{params[:query]}%") unless params[:query].nil?
|
||||||
@bank_transactions = @bank_transactions.page(params[:page]).per(@per_page)
|
@bank_transactions = @bank_transactions.page(params[:page]).per(@per_page)
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Finance::FinancialLinksController < Finance::BaseController
|
||||||
remove_path: remove_financial_transaction_finance_link_path(@financial_link, ft)
|
remove_path: remove_financial_transaction_finance_link_path(@financial_link, ft)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@items += @financial_link.invoices.map do |invoice|
|
@items += @financial_link.invoices.includes(:supplier).map do |invoice|
|
||||||
{
|
{
|
||||||
date: invoice.date || invoice.created_at,
|
date: invoice.date || invoice.created_at,
|
||||||
type: t('activerecord.models.invoice'),
|
type: t('activerecord.models.invoice'),
|
||||||
|
@ -61,7 +61,7 @@ class Finance::FinancialLinksController < Finance::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index_financial_transaction
|
def index_financial_transaction
|
||||||
@financial_transactions = FinancialTransaction.without_financial_link
|
@financial_transactions = FinancialTransaction.without_financial_link.includes(:financial_transaction_type, :ordergroup)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_financial_transaction
|
def add_financial_transaction
|
||||||
|
@ -77,7 +77,7 @@ class Finance::FinancialLinksController < Finance::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index_invoice
|
def index_invoice
|
||||||
@invoices = Invoice.without_financial_link
|
@invoices = Invoice.without_financial_link.includes(:supplier)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_invoice
|
def add_invoice
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- title t('.title')
|
- title t('.title')
|
||||||
|
|
||||||
- for supplier in @suppliers
|
- for supplier in @suppliers
|
||||||
- invoices = supplier.invoices.unpaid
|
- invoices = supplier.invoices
|
||||||
- if invoices.any?
|
- if invoices.any?
|
||||||
%h3= supplier.name
|
%h3= supplier.name
|
||||||
- invoices_sum = 0
|
- invoices_sum = 0
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
- FinancialTransactionClass.sorted.each do |fc|
|
- FinancialTransactionClass.sorted.each do |fc|
|
||||||
%th
|
%th
|
||||||
= fc.display
|
= fc.display
|
||||||
- for ft in current_user.ordergroup.financial_transactions.limit(5).order('created_on DESC')
|
- for ft in current_user.ordergroup.financial_transactions.includes(:financial_transaction_type, :user).limit(5).order('created_on DESC')
|
||||||
%tr
|
%tr
|
||||||
%td= format_time(ft.created_on)
|
%td= format_time(ft.created_on)
|
||||||
%td= h(show_user(ft.user))
|
%td= h(show_user(ft.user))
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
- unless Message.readable_for(current_user).empty?
|
- unless Message.readable_for(current_user).empty?
|
||||||
%section#messages
|
%section#messages
|
||||||
%h2= t '.messages.title'
|
%h2= t '.messages.title'
|
||||||
= render 'messages/messages', messages: Message.readable_for(current_user).order('created_at DESC').limit(5), pagination: false
|
= render 'messages/messages', messages: Message.readable_for(current_user).includes(:sender).order('created_at DESC').limit(5), pagination: false
|
||||||
%p= raw t '.messages.view_all.text', messages: link_to(t('.messages.view_all.messages'), messages_path), threads: link_to(t('.messages.view_all.threads'), message_threads_path)
|
%p= raw t '.messages.view_all.text', messages: link_to(t('.messages.view_all.messages'), messages_path), threads: link_to(t('.messages.view_all.threads'), message_threads_path)
|
||||||
|
|
Loading…
Reference in a new issue