Browse Source

Set default processing attribute to true for new BulkUpload records

pull/2666/head
Manny Dinssa 2 years ago
parent
commit
cd7025de61
  1. 5
      app/models/bulk_upload.rb
  2. 1
      app/services/bulk_upload/processor.rb

5
app/models/bulk_upload.rb

@ -11,6 +11,7 @@ class BulkUpload < ApplicationRecord
has_many :sales_logs
after_initialize :generate_identifier, unless: :identifier
after_initialize :initialize_processing, if: :new_record?
scope :search_by_filename, ->(filename) { where("filename ILIKE ?", "%#{filename}%") }
scope :search_by_user_name, ->(name) { where(user_id: User.where("name ILIKE ?", "%#{name}%").select(:id)) }
@ -155,4 +156,8 @@ private
def generate_identifier
self.identifier ||= SecureRandom.uuid
end
def initialize_processing
self.processing = true if processing.nil?
end
end

1
app/services/bulk_upload/processor.rb

@ -6,7 +6,6 @@ class BulkUpload::Processor
end
def call
bulk_upload.update!(processing: true)
destroy_any_existing_errors_from_prior_run
download

Loading…
Cancel
Save