From 312e51e8dcd2b863f92f838741086e6aecae7c52 Mon Sep 17 00:00:00 2001 From: Benjamin Meichsner Date: Tue, 17 Mar 2009 10:47:00 +0100 Subject: [PATCH] Fixed bug in group_order.price updates, when finishing an order. --- app/models/order.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/order.rb b/app/models/order.rb index 92145a14..9d83e3cc 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -170,12 +170,13 @@ class Order < ActiveRecord::Base oa.update_attribute(:article_price, oa.article.article_prices.first) oa.group_order_articles.each { |goa| goa.save_results! } end - # Update GroupOrder prices - group_orders.each { |go| go.update_price! } - + # set new order state (needed by notify_order_finished) update_attributes(:state => 'finished', :ends => Time.now, :updated_by => user) + # Update GroupOrder prices + group_orders.each { |go| go.update_price! } + # Clean up # Delete no longer required order-history (group_order_article_quantities) and # TODO: Do we need articles, which aren't ordered? (units_to_order == 0 ?)