fix closed group_order totals
This commit is contained in:
parent
d7540bdd20
commit
497c9e0cf1
3 changed files with 14 additions and 2 deletions
|
@ -167,7 +167,7 @@ class GroupOrderArticle < ActiveRecord::Base
|
||||||
# the minimum price depending on configuration. When the order is finished it
|
# the minimum price depending on configuration. When the order is finished it
|
||||||
# will be the value depending of the article results.
|
# will be the value depending of the article results.
|
||||||
def total_price(order_article = self.order_article)
|
def total_price(order_article = self.order_article)
|
||||||
unless order_article.order.finished?
|
if order_article.order.open?
|
||||||
if FoodsoftConfig[:tolerance_is_costly]
|
if FoodsoftConfig[:tolerance_is_costly]
|
||||||
order_article.article.fc_price * (quantity + tolerance)
|
order_article.article.fc_price * (quantity + tolerance)
|
||||||
else
|
else
|
||||||
|
|
12
db/migrate/20130702113610_update_group_order_totals.rb
Normal file
12
db/migrate/20130702113610_update_group_order_totals.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
class UpdateGroupOrderTotals < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
# The group_order total was updated to the total ordered amount instead of
|
||||||
|
# the amount received. Now this is fixed, the totals need to be updated.
|
||||||
|
GroupOrder.all.each do |go|
|
||||||
|
go.order.closed? and go.update_price!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20121230142516) do
|
ActiveRecord::Schema.define(:version => 20130715233410) do
|
||||||
|
|
||||||
create_table "article_categories", :force => true do |t|
|
create_table "article_categories", :force => true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", :default => "", :null => false
|
||||||
|
|
Loading…
Reference in a new issue