Fixed bug in orders index if order.ends.nil?
This commit is contained in:
parent
db52c6e4ed
commit
fbf6a283a0
3 changed files with 8 additions and 3 deletions
|
|
@ -81,7 +81,7 @@ class Ordergroup < Group
|
|||
def update_stats!
|
||||
time = 6.month.ago
|
||||
jobs = users.collect { |u| u.tasks.done.all(:conditions => ["updated_on > ?", time]).size }.sum
|
||||
orders_sum = group_orders.select { |go| go.order.ends > time }.collect(&:price).sum
|
||||
orders_sum = group_orders.select { |go| !go.order.ends.nil? && go.order.ends > time }.collect(&:price).sum
|
||||
update_attribute(:stats, {:jobs_size => jobs, :orders_sum => orders_sum})
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue