Added some eager loading for balancing new.
This commit is contained in:
parent
40d9195eac
commit
6196bdae41
3 changed files with 6 additions and 4 deletions
|
@ -21,7 +21,9 @@ class Finance::BalancingController < Finance::BaseController
|
||||||
sort = "id"
|
sort = "id"
|
||||||
end
|
end
|
||||||
|
|
||||||
@articles = @order.order_articles.ordered.includes(:article).order(sort)
|
@articles = @order.order_articles.ordered.includes(:order, :article, :article_price,
|
||||||
|
group_order_articles: {group_order: :ordergroup}).order(sort)
|
||||||
|
|
||||||
|
|
||||||
if params[:sort] == "order_number"
|
if params[:sort] == "order_number"
|
||||||
@articles = @articles.to_a.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
|
@articles = @articles.to_a.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
= link_to 'Gruppe hinzufügen', new_finance_group_order_article_path(order_article_id: order_article.id),
|
= link_to 'Gruppe hinzufügen', new_finance_group_order_article_path(order_article_id: order_article.id),
|
||||||
remote: true, class: 'btn btn-mini'
|
remote: true, class: 'btn btn-mini'
|
||||||
%tbody
|
%tbody
|
||||||
- for group_order_article in order_article.group_order_articles.ordered.all(:include => [:group_order])
|
- for group_order_article in order_article.group_order_articles.select { |goa| goa.result > 0 }
|
||||||
%tr[group_order_article]
|
%tr[group_order_article]
|
||||||
%td
|
%td
|
||||||
%td{:style=>"width:50%"}
|
%td{:style=>"width:50%"}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
.well.well-small
|
.well.well-small
|
||||||
%h3 Kommentare
|
%h3 Kommentare
|
||||||
#comments= render :partial => 'shared/comments', locals: {comments: @order.comments}
|
#comments= render :partial => 'shared/comments', locals: {comments: @order.comments.includes(:user)}
|
||||||
|
|
||||||
- content_for :actionbar do
|
- content_for :actionbar do
|
||||||
.btn-group
|
.btn-group
|
||||||
|
|
Loading…
Reference in a new issue