diff --git a/app/controllers/finance/balancing_controller.rb b/app/controllers/finance/balancing_controller.rb index 1b55d177..8f40a017 100644 --- a/app/controllers/finance/balancing_controller.rb +++ b/app/controllers/finance/balancing_controller.rb @@ -21,8 +21,10 @@ class Finance::BalancingController < Finance::BaseController sort = "id" 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" @articles = @articles.to_a.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i } elsif params[:sort] == "order_number_reverse" diff --git a/app/views/finance/balancing/_group_order_articles.html.haml b/app/views/finance/balancing/_group_order_articles.html.haml index 3cc34dfd..a4a6bb7a 100644 --- a/app/views/finance/balancing/_group_order_articles.html.haml +++ b/app/views/finance/balancing/_group_order_articles.html.haml @@ -10,7 +10,7 @@ = link_to 'Gruppe hinzufügen', new_finance_group_order_article_path(order_article_id: order_article.id), remote: true, class: 'btn btn-mini' %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] %td %td{:style=>"width:50%"} diff --git a/app/views/finance/balancing/new.html.haml b/app/views/finance/balancing/new.html.haml index 50cb3d4c..e151ccd0 100644 --- a/app/views/finance/balancing/new.html.haml +++ b/app/views/finance/balancing/new.html.haml @@ -20,7 +20,7 @@ .well.well-small %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 .btn-group