Fixed bug in group_order.price updates, when finishing an order.

This commit is contained in:
Benjamin Meichsner 2009-03-17 10:47:00 +01:00
parent 1791243b25
commit 312e51e8dc

View file

@ -170,12 +170,13 @@ class Order < ActiveRecord::Base
oa.update_attribute(:article_price, oa.article.article_prices.first) oa.update_attribute(:article_price, oa.article.article_prices.first)
oa.group_order_articles.each { |goa| goa.save_results! } oa.group_order_articles.each { |goa| goa.save_results! }
end end
# Update GroupOrder prices
group_orders.each { |go| go.update_price! }
# set new order state (needed by notify_order_finished) # set new order state (needed by notify_order_finished)
update_attributes(:state => 'finished', :ends => Time.now, :updated_by => user) update_attributes(:state => 'finished', :ends => Time.now, :updated_by => user)
# Update GroupOrder prices
group_orders.each { |go| go.update_price! }
# Clean up # Clean up
# Delete no longer required order-history (group_order_article_quantities) and # Delete no longer required order-history (group_order_article_quantities) and
# TODO: Do we need articles, which aren't ordered? (units_to_order == 0 ?) # TODO: Do we need articles, which aren't ordered? (units_to_order == 0 ?)