Fixed seed created_at column
This commit is contained in:
@@ -75,7 +75,7 @@ end
|
|||||||
updated_at = created_at + rand(4..44).minutes
|
updated_at = created_at + rand(4..44).minutes
|
||||||
status_changed_at = updated_at
|
status_changed_at = updated_at
|
||||||
end
|
end
|
||||||
job = Job.new(status:, privacy_policy: true, created_at: created_at)
|
job = Job.new(status:, privacy_policy: true)
|
||||||
job.pdf = File.open(Rails.root.join('db/pdfs/', pdf))
|
job.pdf = File.open(Rails.root.join('db/pdfs/', pdf))
|
||||||
student = students[rand(0..9)]
|
student = students[rand(0..9)]
|
||||||
job.customer = student
|
job.customer = student
|
||||||
@@ -84,6 +84,7 @@ end
|
|||||||
job.operator = operator if status != :open
|
job.operator = operator if status != :open
|
||||||
job.cashier = operator if status == :paid
|
job.cashier = operator if status == :paid
|
||||||
job.save!
|
job.save!
|
||||||
|
job.update_column :created_at, created_at # write with update_column to avoid before_save action
|
||||||
job.update_column :printed_at, printed_at # write with update_column to avoid before_save action
|
job.update_column :printed_at, printed_at # write with update_column to avoid before_save action
|
||||||
job.update_column :status_changed_at, status_changed_at # write with update_column to avoid before_save action
|
job.update_column :status_changed_at, status_changed_at # write with update_column to avoid before_save action
|
||||||
job.update_column :paid_at, paid_at if status == :paid # write with update_column to avoid before_save action
|
job.update_column :paid_at, paid_at if status == :paid # write with update_column to avoid before_save action
|
||||||
@@ -109,7 +110,7 @@ end
|
|||||||
updated_at = created_at + rand(4..44).minutes
|
updated_at = created_at + rand(4..44).minutes
|
||||||
status_changed_at = updated_at
|
status_changed_at = updated_at
|
||||||
end
|
end
|
||||||
job = Job.new(status:, privacy_policy: true, created_at: created_at)
|
job = Job.new(status:, privacy_policy: true)
|
||||||
job.pdf = File.open(Rails.root.join('db/pdfs/', pdf))
|
job.pdf = File.open(Rails.root.join('db/pdfs/', pdf))
|
||||||
student = students[rand(0...9)]
|
student = students[rand(0...9)]
|
||||||
job.customer = student
|
job.customer = student
|
||||||
@@ -118,6 +119,7 @@ end
|
|||||||
job.operator = operator if status == :paid
|
job.operator = operator if status == :paid
|
||||||
job.cashier = operator if status == :paid
|
job.cashier = operator if status == :paid
|
||||||
job.save!
|
job.save!
|
||||||
|
job.update_column :created_at, created_at # write with update_column to avoid before_save action
|
||||||
job.update_column :printed_at, printed_at # write with update_column to avoid before_save action
|
job.update_column :printed_at, printed_at # write with update_column to avoid before_save action
|
||||||
job.update_column :status_changed_at, status_changed_at # write with update_column to avoid before_save action
|
job.update_column :status_changed_at, status_changed_at # write with update_column to avoid before_save action
|
||||||
job.update_column :paid_at, paid_at if status == :paid # write with update_column to avoid before_save action
|
job.update_column :paid_at, paid_at if status == :paid # write with update_column to avoid before_save action
|
||||||
|
|||||||
Reference in New Issue
Block a user