Fixed open_orders partial.

This commit is contained in:
benni 2011-06-13 15:26:06 +02:00
parent 5b2df07378
commit adbe93f39e
3 changed files with 5 additions and 6 deletions

View file

@ -82,7 +82,7 @@ class Order < ActiveRecord::Base
def expired? def expired?
!ends.nil? && ends < Time.now !ends.nil? && ends < Time.now
end end
# search GroupOrder of given Ordergroup # search GroupOrder of given Ordergroup
def group_order(ordergroup) def group_order(ordergroup)
group_orders.first :conditions => { :ordergroup_id => ordergroup.id } group_orders.first :conditions => { :ordergroup_id => ordergroup.id }

View file

@ -29,7 +29,7 @@
- if current_user.ordergroup - if current_user.ordergroup
// Current orders // Current orders
= render :partial => 'shared/open_orders' = render :partial => 'shared/open_orders', :locals => {:ordergroup => current_user.ordergroup}
// Stats // Stats
- if current_user.ordergroup - if current_user.ordergroup

View file

@ -15,13 +15,12 @@
%tr{:class => cycle('even', 'odd', :name => 'open_orders')} %tr{:class => cycle('even', 'odd', :name => 'open_orders')}
%td= link_to h(order.name), :controller => 'ordering', :action => 'order', :id => order %td= link_to h(order.name), :controller => 'ordering', :action => 'order', :id => order
%td=h format_time(order.ends) unless order.ends.nil? %td=h format_time(order.ends) unless order.ends.nil?
- if group_order = order.group_order(@ordergroup) - if group_order = order.group_order(ordergroup)
- total += group_order.price - total += group_order.price
%td=h "#{group_order.updated_by.nick} (#{format_time(group_order.updated_on)})" %td= "#{group_order.updated_by.nick} (#{format_time(group_order.updated_on)})"
%td= number_to_currency(group_order.price) %td= number_to_currency(group_order.price)
- else - else
%td %td{:colspan => 2}
%td
- if total > 0 - if total > 0
%p %p
Gesamtsumme: Gesamtsumme: