Fixed bug in deliveries. Extended test fixtures.

This commit is contained in:
Benjamin Meichsner 2009-02-06 17:06:08 +01:00
parent 46d0a9c485
commit 0a87294ed4
9 changed files with 28 additions and 8 deletions

View file

@ -20,7 +20,7 @@
# order_number :string(255) # order_number :string(255)
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# quantity :decimal(, ) default(0.0) # quantity :integer default(0)
# deleted_at :datetime # deleted_at :datetime
# type :string(255) # type :string(255)
# #

View file

@ -21,7 +21,7 @@ class Delivery < ActiveRecord::Base
def stock_change_attributes=(stock_change_attributes) def stock_change_attributes=(stock_change_attributes)
for attributes in stock_change_attributes for attributes in stock_change_attributes
stock_changes.build(attributes) unless attributes[:quantity] == 0.0 or attributes[:quantity].blank? stock_changes.build(attributes) unless attributes[:quantity].to_i == 0
end end
end end

View file

@ -20,7 +20,7 @@
# order_number :string(255) # order_number :string(255)
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# quantity :decimal(, ) default(0.0) # quantity :integer default(0)
# deleted_at :datetime # deleted_at :datetime
# type :string(255) # type :string(255)
# #

View file

@ -7,7 +7,7 @@
# delivery_id :integer # delivery_id :integer
# order_id :integer # order_id :integer
# stock_article_id :integer # stock_article_id :integer
# quantity :decimal(, ) default(0.0) # quantity :integer default(0)
# created_at :datetime # created_at :datetime
# #

View file

@ -29,6 +29,6 @@
= form.text_field :deposit = form.text_field :deposit
%p %p
Kategorie: Kategorie:
= form.select :article_category, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] } = form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
%p %p
= submit_tag "Artikel speichern" = submit_tag "Artikel speichern"

View file

@ -14,3 +14,5 @@ fruits:
description: fruits and only fruits description: fruits and only fruits
vegi: vegi:
name: Vegetables name: Vegetables
other:
name: Other stuff

View file

@ -37,3 +37,10 @@ potatoe1:
price: 1.33 price: 1.33
tax: 7.0 tax: 7.0
unit_quantity: 25 unit_quantity: 25
applejuice1:
article: applejuice
price: 1.15
tax: 7.0
unit_quantity: 1
deposit: 0.15

View file

@ -20,7 +20,7 @@
# order_number :string(255) # order_number :string(255)
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# quantity :decimal(, ) default(0.0) # quantity :integer default(0)
# deleted_at :datetime # deleted_at :datetime
# type :string(255) # type :string(255)
# #
@ -38,6 +38,7 @@ banana:
tax: 7.0 tax: 7.0
unit_quantity: 18 unit_quantity: 18
order_number: 123456 order_number: 123456
kiwi: kiwi:
supplier: terra supplier: terra
name: Kiwi name: Kiwi
@ -49,6 +50,7 @@ kiwi:
tax: 7.0 tax: 7.0
unit_quantity: 10 unit_quantity: 10
order_number: 123457 order_number: 123457
potatoe: potatoe:
supplier: terra supplier: terra
name: Potatoe name: Potatoe
@ -60,3 +62,12 @@ potatoe:
tax: 7.0 tax: 7.0
unit_quantity: 25 unit_quantity: 25
order_number: 123458 order_number: 123458
applejuice:
type: StockArticle
supplier: terra
name: Apple-juice
article_category: other
unit: 1L
price: 1.33
tax: 7.0

View file

@ -7,7 +7,7 @@
# delivery_id :integer # delivery_id :integer
# order_id :integer # order_id :integer
# stock_article_id :integer # stock_article_id :integer
# quantity :decimal(, ) default(0.0) # quantity :integer default(0)
# created_at :datetime # created_at :datetime
# #