add migration and adapt fixture and factories
This commit is contained in:
parent
c28731a1ea
commit
ace6551880
4 changed files with 24 additions and 6 deletions
6
db/migrate/20230220214408_add_price_per_to_articles.rb
Normal file
6
db/migrate/20230220214408_add_price_per_to_articles.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class AddPricePerToArticles < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
add_column :articles, :price_per, :float, default: 0.0
|
||||||
|
add_column :articles, :unit_symbol, :string
|
||||||
|
end
|
||||||
|
end
|
15
db/schema.rb
15
db/schema.rb
|
@ -10,7 +10,17 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_01_06_144440) do
|
ActiveRecord::Schema[7.0].define(version: 2023_02_20_214408) do
|
||||||
|
create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
||||||
|
t.string "name", null: false
|
||||||
|
t.text "body", size: :long
|
||||||
|
t.string "record_type", null: false
|
||||||
|
t.bigint "record_id", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
create_table "active_storage_attachments", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
create_table "active_storage_attachments", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.string "record_type", null: false
|
t.string "record_type", null: false
|
||||||
|
@ -75,6 +85,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_06_144440) do
|
||||||
t.datetime "deleted_at", precision: nil
|
t.datetime "deleted_at", precision: nil
|
||||||
t.string "type"
|
t.string "type"
|
||||||
t.integer "quantity", default: 0
|
t.integer "quantity", default: 0
|
||||||
|
t.float "price_per", default: 0.0
|
||||||
|
t.string "unit_symbol"
|
||||||
t.index ["article_category_id"], name: "index_articles_on_article_category_id"
|
t.index ["article_category_id"], name: "index_articles_on_article_category_id"
|
||||||
t.index ["name", "supplier_id"], name: "index_articles_on_name_and_supplier_id"
|
t.index ["name", "supplier_id"], name: "index_articles_on_name_and_supplier_id"
|
||||||
t.index ["supplier_id"], name: "index_articles_on_supplier_id"
|
t.index ["supplier_id"], name: "index_articles_on_supplier_id"
|
||||||
|
@ -282,7 +294,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_06_144440) do
|
||||||
create_table "messages", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
create_table "messages", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
||||||
t.integer "sender_id"
|
t.integer "sender_id"
|
||||||
t.string "subject", null: false
|
t.string "subject", null: false
|
||||||
t.text "body"
|
|
||||||
t.boolean "private", default: false
|
t.boolean "private", default: false
|
||||||
t.datetime "created_at", precision: nil
|
t.datetime "created_at", precision: nil
|
||||||
t.integer "reply_to"
|
t.integer "reply_to"
|
||||||
|
|
|
@ -7,6 +7,7 @@ FactoryBot.define do
|
||||||
tax { [6, 21].sample }
|
tax { [6, 21].sample }
|
||||||
deposit { rand(10) < 8 ? 0 : [0.0, 0.80, 1.20, 12.00].sample }
|
deposit { rand(10) < 8 ? 0 : [0.0, 0.80, 1.20, 12.00].sample }
|
||||||
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }
|
unit_quantity { rand(5) < 3 ? 1 : rand(1..20) }
|
||||||
|
price_per { rand(0.1..26.0).round(2) }
|
||||||
|
|
||||||
factory :article do
|
factory :article do
|
||||||
sequence(:name) { |n| Faker::Lorem.words(number: rand(2..4)).join(' ') + " ##{n}" }
|
sequence(:name) { |n| Faker::Lorem.words(number: rand(2..4)).join(' ') + " ##{n}" }
|
||||||
|
|
8
spec/fixtures/bnn_file_01.bnn
vendored
8
spec/fixtures/bnn_file_01.bnn
vendored
|
@ -1,5 +1,5 @@
|
||||||
BNN;3;0;Naturkost Nord, Hamburg;T;Angebot Nr. 0922;EUR;20220905;20221001;20220825;837;1
|
BNN;3;0;Naturkost Nord, Hamburg;T;Angebot Nr. 0922;EUR;20220905;20221001;20220825;837;1
|
||||||
29932;;;;4280001958081;4280001958203;Walnoten (ongeroosterd);bio;;;med;;GR;C%;DE-?KO-001;120;1302;10;55;;1;;1;1 kg;1;N;930190;99260;;1,41;;;;1;;;4,49;2,34;J;;2;3;;;;;;;;;;;;;;;;;;;A;;;;;Kg;28,571;;
|
29932;;;;4280001958081;4280001958203;Walnoten (ongeroosterd);bio;;;med;;GR;C%;DE-?KO-001;120;1302;10;55;;1;;1;1 kg;1;N;930190;99260;;1,41;;;;1;;;4,49;2,34;J;;2;3;;;;;;;;;;;;;;;;;;;A;;;;;Kg;1;;
|
||||||
28391;;;;4280001958081;4280001958203;Pijnboompitten;dem;;;med;;GR;C%;DE-?KO-001;120;1302;10;55;;1;;1;100 g;10;N;930190;99260;;1,41;;;;1;;;5,56;2.89;J;;2;3;;;;;;;;;;;;;;;;;;;A;;;;;Kg;28,571;;
|
28391;;;;4280001958081;4280001958203;Pijnboompitten;dem;;;med;;GR;C%;DE-?KO-001;120;1302;10;55;;1;;1;100 g;10;N;930190;99260;;1,41;;;;1;;;5,56;2.89;J;;2;3;;;;;;;;;;;;;;;;;;;A;;;;;Kg;10;;
|
||||||
1829;;;;4280001958081;4280001958203;Appelsap (verpakt);;;;med;;GR;C%;DE-?KO-001;120;1302;10;55;;1;4x250 ml;10;4x250 ml;10;N;930190;99260;;3,21;;;;1;;;4,49;2.89;J;;2;3;;;;;;;;;;;;;;;;;;;A;;;;;ml;28,571;;
|
1829;;;;4280001958081;4280001958203;Appelsap (verpakt);;;;med;;GR;C%;DE-?KO-001;120;1302;10;55;;1;4x250 ml;10;4x250 ml;10;N;930190;99260;;3,21;;;;1;;;4,49;2.89;J;;2;3;;;;;;;;;;;;;;;;;;;A;;;;;l;4;;
|
||||||
177813;;;;4280001958081;4280001958203;Tomaten;bio;;;med;;GR;C%;DE-?KO-001;120;1302;10;55;;1;;1;500 g;20;N;930190;99260;;1,20;;;;1;;;4,49;2.89;J;;2;3;;;;;;;;;;;;;;;;;;;A;;;;;g;28,571;;
|
177813;;;;4280001958081;4280001958203;Tomaten;bio;;;med;;GR;C%;DE-?KO-001;120;1302;10;55;;1;;1;500 g;20;N;930190;99260;;1,20;;;;1;;;4,49;2.89;J;;2;3;;;;;;;;;;;;;;;;;;;A;;;;;Kg;2;;
|
||||||
|
|
Loading…
Reference in a new issue