Fixed missing group_order_article in group_order show.
Also add eager loading for associated objects.
This commit is contained in:
parent
0fcd5abb3a
commit
9919183cb0
4 changed files with 22 additions and 17 deletions
|
|
@ -54,26 +54,21 @@
|
|||
= category_name
|
||||
%i.icon-tag
|
||||
%td{colspan: "9"}
|
||||
- for oa in order_articles
|
||||
- order_articles.each do |oa|
|
||||
- # get the order-results for the ordergroup
|
||||
- goa = oa.group_order_articles.find_by_group_order_id(@group_order.id)
|
||||
- quantity = goa.quantity
|
||||
- tolerance = goa.tolerance
|
||||
- result = goa.result
|
||||
- sub_total = goa.total_price
|
||||
- total += sub_total
|
||||
%tr{class: cycle('even', 'odd', name: 'articles') + " " + order_article_class_name(quantity, tolerance, result)}
|
||||
- r = get_order_results(oa, @group_order.id)
|
||||
%tr{class: cycle('even', 'odd', name: 'articles') + " " + order_article_class_name(r[:quantity], r[:tolerance], r[:result])}
|
||||
%td{style: "width:40%"}
|
||||
=h oa.article.name
|
||||
= oa.article.name
|
||||
- unless oa.article.note.blank?
|
||||
= image_tag("lamp_grey.png", {alt: "Notiz anzeigen", size: "15x16", border: "0", onmouseover: "$('note_#{oa.id}').show();", onmouseout: "$('note_#{oa.id}').hide();"})
|
||||
%td= "#{oa.price.unit_quantity} x #{oa.article.unit}"
|
||||
%td= number_to_currency(oa.price.fc_price)
|
||||
%td
|
||||
= quantity
|
||||
= "+ #{tolerance}" if oa.price.unit_quantity > 1
|
||||
%td= result > 0 ? result : "0"
|
||||
%td= number_to_currency(sub_total)
|
||||
= r[:quantity]
|
||||
= "+ #{r[:tolerance]}" if oa.price.unit_quantity > 1
|
||||
%td= r[:result] > 0 ? r[:result] : "0"
|
||||
%td= number_to_currency(r[:sub_total])
|
||||
- unless oa.article.note.blank?
|
||||
%tr{id: "note_#{oa.id}", class: "note even", style: "display:none"}
|
||||
%td{colspan: "6"}=h oa.article.note
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue