diff --git a/app/models/group_order_article.rb b/app/models/group_order_article.rb index 50c1aa0e..3b37a990 100644 --- a/app/models/group_order_article.rb +++ b/app/models/group_order_article.rb @@ -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 diff --git a/db/migrate/20130702113610_update_group_order_totals.rb b/db/migrate/20130702113610_update_group_order_totals.rb new file mode 100644 index 00000000..ca9aab67 --- /dev/null +++ b/db/migrate/20130702113610_update_group_order_totals.rb @@ -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