Worked on layout, added model funktions, changed database
Changes to the migration file make it necessary to reimport the database: db:drop, db:create, db:migrate, db:seed
This commit is contained in:
@@ -7,15 +7,19 @@ class CreateJobs < ActiveRecord::Migration[7.1]
|
||||
t.string :operator_lastname
|
||||
t.string :costumer_firstname
|
||||
t.string :costumer_lastname
|
||||
t.boolean :paid
|
||||
t.boolean :printed, default: false
|
||||
t.boolean :paid, default: false
|
||||
t.datetime :printed_at
|
||||
t.boolean :intern
|
||||
t.datetime :paid_at
|
||||
t.boolean :intern, default: false
|
||||
t.string :cost_center
|
||||
t.integer :number_of_plans_a0
|
||||
t.integer :number_of_plans_a1
|
||||
t.integer :number_of_plans_a2
|
||||
t.integer :number_of_plans_a3
|
||||
t.float :costum_qm_plan
|
||||
t.integer :status, default: 0, index: true
|
||||
t.integer :number_of_plans_a0, default: 0
|
||||
t.integer :number_of_plans_a1, default: 0
|
||||
t.integer :number_of_plans_a2, default: 0
|
||||
t.integer :number_of_plans_a3, default: 0
|
||||
t.float :costum_qm_plan, default: 0
|
||||
t.string :pdf
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
19
db/schema.rb
generated
19
db/schema.rb
generated
@@ -18,19 +18,24 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_30_214152) do
|
||||
t.string "operator_lastname"
|
||||
t.string "costumer_firstname"
|
||||
t.string "costumer_lastname"
|
||||
t.boolean "paid"
|
||||
t.boolean "printed", default: false
|
||||
t.boolean "paid", default: false
|
||||
t.datetime "printed_at"
|
||||
t.boolean "intern"
|
||||
t.datetime "paid_at"
|
||||
t.boolean "intern", default: false
|
||||
t.string "cost_center"
|
||||
t.integer "number_of_plans_a0"
|
||||
t.integer "number_of_plans_a1"
|
||||
t.integer "number_of_plans_a2"
|
||||
t.integer "number_of_plans_a3"
|
||||
t.float "costum_qm_plan"
|
||||
t.integer "status", default: 0
|
||||
t.integer "number_of_plans_a0", default: 0
|
||||
t.integer "number_of_plans_a1", default: 0
|
||||
t.integer "number_of_plans_a2", default: 0
|
||||
t.integer "number_of_plans_a3", default: 0
|
||||
t.float "costum_qm_plan", default: 0.0
|
||||
t.string "pdf"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["costumer_id"], name: "index_jobs_on_costumer_id"
|
||||
t.index ["operator_id"], name: "index_jobs_on_operator_id"
|
||||
t.index ["status"], name: "index_jobs_on_status"
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
|
||||
16
db/seeds.rb
16
db/seeds.rb
@@ -13,3 +13,19 @@ Faker::Config.locale = :de
|
||||
10.times do
|
||||
User.new(firstname: Faker::Name.unique.first_name, lastname: Faker::Name.unique.last_name).save
|
||||
end
|
||||
['GanzWichtig.pdf', 'IchBinIn5MinDran.pdf', 'DerPlanDerImmerProblemeMacht.pdf',
|
||||
'DieFarbenGefallenMirNicht.pdf', 'MachHinIchHabsEilig.pdf', 'WarumDauertDasSoLange.pdf',
|
||||
'DenPlanBezahleIchNicht.pdf', 'IchWarAlsErstesDran.pdf', 'WarumIstDerPlotterDefekt.pdf', 'DasNächsteMalGeheIchWoAndersHin'].shuffle.each do |pdf|
|
||||
a0 = rand(0...7)
|
||||
a1 = rand(0...7)
|
||||
a2 = rand(0...7)
|
||||
a3 = rand(0...7)
|
||||
a0.zero? || a1 = 0 && a2 = 0 && a3 = 0
|
||||
a1.zero? || a2 = 0 && a3 = 0
|
||||
a2.zero? || a3 = 0
|
||||
status = %i[open printing ready_for_pickup paid cancelled].sample
|
||||
|
||||
Job.new(costumer_firstname: Faker::Name.unique.first_name, costumer_lastname: Faker::Name.unique.last_name,
|
||||
number_of_plans_a0: a0, number_of_plans_a1: a1, number_of_plans_a2: a2, number_of_plans_a3: a3,
|
||||
pdf:, status:).save
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user