Merge pull request #144 from foodcoop-adam/fix-closed-group_order-totals

fix closed group_order totals
This commit is contained in:
Benjamin Meichsner 2013-09-19 03:14:40 -07:00
commit 2060261c89
2 changed files with 19 additions and 1 deletions

View File

@ -167,7 +167,7 @@ class GroupOrderArticle < ActiveRecord::Base
# the minimum price depending on configuration. When the order is finished it
# will be the value depending of the article results.
def total_price(order_article = self.order_article)
unless order_article.order.finished?
if order_article.order.open?
if FoodsoftConfig[:tolerance_is_costly]
order_article.article.fc_price * (quantity + tolerance)
else

View File

@ -0,0 +1,18 @@
class UpdateGroupOrderTotals < ActiveRecord::Migration
def self.up
say "If you have ever modified an order after it was settled, the group_order's " +
"price may be calculated incorrectly. This can take a lot of time on a " +
"large database."
say "If you do want to update the ordergroup totals, open the rails console " +
"(by running `rails c`), and enter:"
say "GroupOrder.all.each { |go| go.order.closed? and go.update_price! }", subitem: true
say "You may want to check first that no undesired accounting issues are introduced. " +
"It may be wise to discuss this with those responsible for the ordering finances."
end
def self.down
end
end